简体   繁体   中英

gnuplot: plot disappears when adding “set xrange”

I've got a strange problem using "set xrange" with a simple code and I don't get it. I have the code:

set style data histograms    
set style histogram clustered gap 1    
set style fill solid 1.0     
set boxwidth 0.9    
set auto x    
set xtic rotate by -70 scale 1     
set yrange [0:32]    
set ylabel 'percentage [%]'    
set xlabel 'Year'    
set key top left

plot '../ölkj.txt' using 3 title 'ölkj', 'asdf.txt' u 2 title 'asdf'

Everything is fine. But when I add

set xrange[1997:2014]

the plot disappears, just the axes, their label and the legend remains.

The data is in the following format:

2012    14,81   20
2013    15,11   18,18
2014    15,83   20

Any ideas?

I had a similar problem just now using time data:

I used

set timefmt "%s"
set ydata time
set yrange [0:600]

and my plot disappeared.

Replacing set yrange [0:600] with set yrange ["0":"600"] made it appear again.

This might be caused by gnuplot not parsing the yrange arguments when its not enclosed in " and using a different internal representation for timestamps.

I could observe this by looking at the mouse-coordinates on the empty plot. Pressing "Apply autoscale" made gnuplot show my plot. The mouse-coordinates then looked totally different.

I think what you are trying to achieve by set xrange is to get the year labels on your x-axis. You can do that by just altering your plot command to:

plot '../ölkj.txt' using 3:xtic(1) title 'ölkj', 'asdf.txt' u 2:xtic(1) title 'asdf'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM