Uwe Müller
Uwe Müller

Reputation: 61

Round ytics to nearest ten

I want to create a bar chart with gnuplot where I have exactly 5 tics on the y axis. I use this answer to do this. However, I get very exact numbers on the ytics when I do this. By doing set ytics format "%.0f", I can round the values to the nearest number. However, I want to round these numbers again to the next ten as well. So when I get the value 91.7 on the y-axis, it should instead make a tic at 90 or 100.

Is there a possibility to do this in gnuplot?

Upvotes: 1

Views: 254

Answers (2)

jme52
jme52

Reputation: 1123

If you want to have the same spacing between all ticks, you could just adapt the answer you link to by changing the two operations involving the factor 10:

dy = floor((GPVAL_Y_MAX-GPVAL_Y_MIN)/(ntics*10.))*10

Upvotes: 1

Ethan
Ethan

Reputation: 15118

"set ytics 10" will give one tic every 10 units over whatever range is relevant.

Upvotes: 0

Related Questions