简体   繁体   中英

Gnuplot negative x range and logscale

I am trying to plot some data with Gnuplot and would like to use a logscale on the x axis. This does not work, Gnuplot gives the error "x range must be greater than 0 for log scale". I saw examples that used a logscale with negative values on the y axis and tried to do it similar for the x axis, but it seems I can not get it to work. Initially I thought it would be the zero values, but even when I remove them, it does not work.

This is a little example:

stats 'stat_data1'
num1=STATS_records
stats 'stat_data2'
num2=STATS_records

set terminal pdf
set output "Cumulative_noise.pdf"
set autoscale yfix
set autoscale xfix
set key bottom right
set xlabel 'Noise in dB'
set ylabel 'Percent'
set xrange [0:110] reverse
set logscale x

set style increment user
set style line 2  lc rgb '#FF0000' lt 1 pt 1 ps 1
set style line 3  lc rgb '#008000' lt 2 pt 2 ps 2
set style line 4  lc rgb '#0000FF' lt 3 pt 3 ps 3

plot 0/0 notitle,\
'stat_data1' u (-$3) : ((100.0/num1)) title 'Node 1' smooth cumulative,\
'stat_data2' u (-$3) : ((100.0/num2)) title 'Node 2' smooth cumulative

And here some data. First file:

1437818411 -54 -95 85.2 0.0
1437818425 -54 -95 78.0 0.0
1437818440 -71 -95 38.7 0.0
1437818456 -70 -95 51.7 0.0
1437818471 -71 -95 42.0 0.0

Second file:

1437818545 -50 -95 43.7 100.0
1437818561 -51 -95 52.0 100.0
1437818576 -50 -94 79.4 0.10744142234781584
1437818592 -51 -94 16.6 0.308927509416507
1437818605 -49 -95 85.2 0.04368438558438699

I hope somebody has an idea as this would be very convenient. Thank you in advance!

The numbers given in the xrange settings are also subject to the actual axis transformations.

Removing the set xrange [0:110] fixes the error.

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