Search code examples
gnuplot

How do I change the X-Range without altering the data in Gnuplot?


How do I change the xrange without affecting how my data on the plot looks? The range is [0:1000] and I want to switch it to [0:100], what i actually want is to convert it instead of changing it by divinding the range by ten. But whenever I try, the way the plot looks also changes. I tried by using xrange [0:100] but it didn't work. Can someone help?


Solution

  • Without example data and graph it's still not fully clear to me, but my guess is the following: You want to divide your data by factor of 10. Check the following example.

    Code:

    ### scale x-data
    reset session
    
    $Data <<EOD
       0   1
     100   2
     200   3
     300   4
     400   3
     500   2
     600   1
     700   2
     800   3
     900   4
    1000   3
    EOD
    
    set key top center
    set multiplot layout 2,1
    
        plot $Data u 1:2       w lp pt 7 lc "red"
    
        plot $Data u ($1/10):2 w lp pt 7 lc "web-green"
    
    unset multiplot
    ### end of code
    

    Result:

    enter image description here