Reputation: 21
I'm trying to change the scale of the x-axis linearly, that is, that the distance between the points was proportional, so I have two points (12.23 and 12.12) that should be glued together and others like 19.35 with 23, 8 that should be well spaced and 23.8 to 24.7 that should be closer, but I was not able to do this correctly.
reset
set encoding iso_8859_1
set key fixed right top vertical Right noreverse noenhanced autotitle nobox
set style increment default
set datafile missing '-'
set style data linespoints
set xtics border in scale 1,0.5 nomirror rotate by -45 # autojustify
set xtics norangelimit
set xtics ()
set log x
set key center top inside
set title "DC 5,86%"
set xrange [ * : * ] noreverse writeback
set x2range [ * : * ] noreverse writeback
set yrange [ * : * ] noreverse writeback
set y2range [ * : * ] noreverse writeback
set zrange [ * : * ] noreverse writeback
set cbrange [ * : * ] noreverse writeback
set rrange [ * : * ] noreverse writeback
plot 'teste2.dat' using 2:xtic(1) title columnheader(2),'teste2.dat' using 3:xtic(1) title columnheader(3)
my test2.dat is:
DC L=1 L>1
42.85 15.98 -
32.5 - 26.09
30.76 23.12 -
24.7 - 31.75
23.8 33.1 -
19.35 42.11 -
14.03 61.72 -
12.23 62.65 -
12.12 - 75.38
10.98 44.58 -
I've been trying to do this for some time. Could someone help me with this function?
Upvotes: 0
Views: 1145
Reputation: 26198
Are you sure you provided the actual code to produce this graph? The title is different.
Anyway, if you look at your code there is the line set log x
, so your x-axis is scaled logarithmically. Detlete this line and the scaling should be linear.
Futhermore, actually, you are coding: using 2:xtic(1)
, this will set the first column as text label.
And the distances between each labels will be 1, not the real x distance.
If you want to have the real x value on the x axis you have to code: using 1:2
.
A further problem could be that your input data has decimal point where in the output graph I see comma. It could be (not sure) that gnuplot will just take integer values from the input data.
Try the following:
Code:
### simple plot
reset session
$Data <<EOD
DC L=1 L>1
42.85 15.98 -
32.5 - 26.09
30.76 23.12 -
24.7 - 31.75
23.8 33.1 -
19.35 42.11 -
14.03 61.72 -
12.23 62.65 -
12.12 - 75.38
10.98 44.58 -
EOD
plot $Data u 1:2 w lp pt 7 title columnheader(2), \
'' u 1:3 w lp pt 7 title columnheader(3)
### end of code
Result:
Upvotes: 1