Search code examples
gnuplot

gnuplot - How to rescale xaxis but using the same dataset


I have the following CSV data:

-140,0
-139,0
-138,0
...
-4,240
-3,609
-2,1426
-1,7352
+0,624209
+1,7269
+2,1376
+3,553
...
+138,0
+139,0
+140,0

And the following gnuplot command:

set terminal x11
set xrange [-10:10]
set auto y
set datafile separator ","
set xtics 1
plot 'histogram1min.csv'  using 1:2 title columnheader with boxes
pause mouse

This creates an histogram with x axis with values from -10 to +10 in steps of 1.

I would like to change xaxis so -10 is presented -0.0010, -9 is presented as -0.0009 etc. -i.e. instead of using -10 to +10 we scale xaxis dividing by 1000 but using the same dataset-.

So, just to further clarify, data point -0.001 will have value 7352.


Solution

  • When using column 1, just do the division there. You will have to get rid of the set xrange and set xtics lines or adjust those values.

    plot 'histogram1min.csv'  using ($1/1000):2 title columnheader with boxes