Search code examples
alignmentgnuplothorizontal-scaling

Gnuplot shifted x-axis


Hello I have following gnuplot example data in 3 files:

format kompression avgcover avgdiff1 avgdiff2
jp2 10 95.68 3.74 4.02
jp2 20 95.63 3.79 4.01
jp2 30 95.62 3.80 3.92
jp2 40 95.81 3.61 3.79
jp2 50 96.13 3.29 3.72
jp2 60 96.59 2.83 3.64
jp2 70 96.76 2.66 3.25
jp2 80 97.05 2.37 2.99
jp2 90 97.17 2.25 2.83
jp2 100 97.24 2.18 2.52

format kompression avgcover avgdiff1 avgdiff2
jpg 10 95.12 2.25 2.83
jpg 20 95.23 3.79 4.01
jpg 30 95.34 2.66 3.25
jpg 40 95.23 3.61 3.79
jpg 50 96.16 3.64 3.72
jpg 60 96.86 2.83 2.37
jpg 70 96.23 2.66 3.25
jpg 80 97.12 2.37 3.64
jpg 90 97.44 2.25 2.83
jpg 100 97.24 2.18 2.52

format kompression avgcover avgdiff1 avgdiff2
jxr 10 95.12 2.25 2.83
jxr 20 95.23 3.79 4.01
jxr 30 95.34 2.66 3.25
jxr 40 95.23 3.61 3.79
jxr 50 96.16 3.64 3.72
jxr 60 96.86 2.83 2.37
jxr 70 96.23 2.66 3.25
jxr 80 97.12 2.37 3.64
jxr 90 97.44 2.25 2.83
jxr 100 97.24 2.18 2.52

Now I have the following gnuplot command:

set term postscript eps enhanced color
set xlabel "Kompression"
set ylabel "Wert"
set size 1,1
set yrange[90:100]
set y2range[0:10]
set y2tics
set ytics nomirror
set key outside right top
set style data histogram
set style fill solid border -1
set output 'test.eps'
set key outside right top
set style line 1 lt 1 lw 3 pt 2 lc rgb "red"
set style line 2 lt 1 lw 1 pt 1 lc rgb "orchid"
set style line 3 lt 1 lw 3 pt 2 lc rgb "blue"
set style line 4 lt 1 lw 1 pt 1 lc rgb "light-turquoise"
set style line 5 lt 1 lw 3 pt 2 lc rgb "dark-green"
set style line 6 lt 1 lw 1 pt 1 lc rgb "greenyellow"
plot './ergebnisse/outputFDSQL_jp2.dat' using 3:xtic(2) ls 1 
    title'JP2(cov)' axis x1y1, '' u 4 ls 2 title 'JP2(notc)' axis x1y2, '' u 5 ls 2   
    title 'JP2(morc)'axis x1y2, './ergebnisse/outputFDSQL_jpg.dat' using 3:xtic(2) ls 3 
    title 'JPG(cov)' axis x1y1 , '' u 4 ls 4 title 'JPG(notc)' axis x1y2, '' u 5 ls 4 
    title 'JPG(morc)' axis x1y2, './ergebnisse/outputFDSQL_jxr.dat' using 3:xtic(2) ls 
    5 title 'JXR(cov)' axis x1y1 , '' u 4 ls 6 title 'JXR(notc)' axis x1y2, '' u 5 ls 6 
    title 'JXR(morc)' axis x1y2

This results in the following outputfile:

test.eps

Here you can see that the values from 0-100 on the x-axis are shifted not correct, does anybody see the error in the code?


Solution

  • There doesn't seem to be anything wrong with this code, the data your posted and your codes gives me this:

    enter image description here

    Can you think of anything else you are doing?

    Edit:

    The file headers were messing up your graph, which were not posted originally with the data. You can comment them out, rather than delete them. Use # before the commented text.