问题
I found this strange behaviour when using gnuplot (ver 4.4), it repeats the same y-axis ticks labels when set format y "%10.0f" command is used and y range is relatively low. If I set it up to "%10.5f" the numbers don't repeat but the "0.5" rounding isn't logical in my case. So I'm looking for a solution with minimal changes to the following script, any help appreciated!
Example with repeating y-axis ticks labels:

Data:
0.5 -
1 3.000
2 4.000
3 4.000
4 2.000
5 1.000
Script:
set encoding cp1250
set datafile separator "\t"
set datafile missing "-"
set terminal png font "arial" small size 1090,282 xffffff x000000 x404040 x00aa66 xdd3300
set output "output.png"
set key off
set grid
set boxwidth 0.9 relative
set style data histograms
set style fill solid 0.6 border -1
set decimalsign ","
set format y "%10.0f"
set xtics ('28.02.2011-06.03.2011' 1,'07.03.2011-13.03.2011' 2,'14.03.2011-20.03.2011' 3,'21.03.2011-27.03.2011' 4,'28.03.2011-03.04.2011' 5)
set ylabel 'Label'
set xrange [0.5:5.5]
plot "data.dat" using 2
回答1:
The repetition of y tic entries is due to the fact that you format the y tics to be displayed without any decimal places. Therefore a 3,5 is rounded towards a 4 and and so forth. There are a few solutions that would circumvent that.
- Allow decimal places to be displayed:
set format y "%.1f"
- Try too fool around with
set ytics autofreq
. For instanceset ytics autofreq 1
would accomplish the same thing you try to achieve in your script but without the repetition.
Hope that helped...
Cherio
Woltan
来源:https://stackoverflow.com/questions/5829811/repeating-y-axis-tick-labels