1
votes

Is there a simple way to set user defined minor tics in gnuplot, analogous to

set ytics add (gprintf("$%g$", -1.0e0) mytic(-1.0e0))

for major tics? mytic in this example is a user defined function which describes the scaling on the y-axis.

1

1 Answers

4
votes

If I'm reading your question properly, you should be able to do something like this...

set ytics add ("Label" <pos> 1)  #The trailing 1 makes it a minor tic...

In my test however (using the X11 terminal), "Label" seemed to be ignored. -- maybe because it is a ytic... Here's my test...

set ytics add ( "Label" pi/4. 1)  #creates a minor ytic at ~.785
plot sin(x)

Edit You could add a label to the above with set label "label" at graph 0,first pi/4. if you wanted one. If you really want to save yourself some typing, you could probably work up something using eval, sprintf and a function ... Something like:

add_tic(what,where)=sprintf("set label \"%s\" at graph 0,first %f;set ytics add ('' %f 1)",what,where,where)
eval(add_tic("Hello World",pi/4))
eval(add_tic("Tux is cool",.55))
plot sin(x)

And then from there you can play around with the justification and offset of the label to place it where you want.