Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gnuplot - Colored tic marks

Tags:

gnuplot

Is there any way to have gnuplot color the tic marks in the x and/or y axis? I'm using a background png file which is quite dark and I'd like the inner tics to show in white over it, not the default black.

like image 271
Gabriel Avatar asked Sep 13 '12 14:09

Gabriel


People also ask

How to change color of points in gnuplot?

Gnuplot can change the color of a line or point based on the values of the data. As usual, there are three ways to do this: explicitly (using the rgb keyword), by indexed lookup (using an integer index), and using a gradient (with the palette keyword).

How to set color in gnuplot?

For terminals that support dot/dash patterns, each default linetype has both a dot-dash pattern and a default color. However, you can override the default color by using the keyword linecolor, abbreviated lc.

What is Ytics in gnuplot?

The set ytics command controls major (labelled) tics on the y axis. Please see set xtics (p. ) for details.

What is gnuplot Xtics?

Fine control of the major (labelled) tics on the x axis is possible with the set xtics command. The tics may be turned off with the unset xtics command, and may be turned on (the default state) with set xtics. Similar commands control the major tics on the y, z, x2 and y2 axes.


2 Answers

The tics seem to inherit their color from the border:

set style line 50 lt 1 lc rgb "red" lw 2
set border ls 50
plot sin(x)

The tic labels get their color from the textcolor option of tics:

set tics textcolor rgb "red"

(The string "white" should work too, but that wouldn't look very nice in my demonstration since my background is white).

There is no way to change just the tic-color. However, if you want, you can change the tic/border color and then add a new border on top:

set arrow from graph 0,graph 1 to graph 1,graph 1 nohead ls -1 lc rgb "black" front
set arrow from graph 1,graph 1 to graph 1,graph 0 nohead ls -1 lc rgb "black" front
set arrow from graph 1,graph 0 to graph 0,graph 0 nohead ls -1 lc rgb "black" front
set arrow from graph 0,graph 0 to graph 0,graph 1 nohead ls -1 lc rgb "black" front
like image 136
mgilson Avatar answered Sep 19 '22 17:09

mgilson


Whilst this post is quite old, I though I'd offer my 2cents because I have a valid addition to the above.

If you immediately follow the set border command with unset border, then the colour of the tics & their labels remains in the colour you set, and the border just gets removed. For example,

set border linecolor rgb "gray75"
unset border

This way, you can at least change the colour of the tics & their labels (here, off-white), & your background remains dark & untainted by an unsightly (off-white) border, which is what the OP asked for?

Thus, no need to manually redraw the border in the previous answer. Still, the best answer above was useful to me so I will uptick!

like image 24
dicksters Avatar answered Sep 20 '22 17:09

dicksters