How to set axis units in gnuplot

Yotam picture Yotam · Jun 27, 2011 · Viewed 12.1k times · Source

I'm trying to generate some schematic figures using gnuplot. My x scale is of angstrom and the y scale if of mV. Currently, I have the x scale goes like:

0 1e-9 2e-9 3e-9 etc.

And my y scale goes like

-0.07 -0.06 -0.05 etc.

And I want them to be

0 10 20 30 etc.
-70.0 -60.0 -50.0 etc.

respectively. Is there a way to do this from within the gnuplot (apart from setting the xrange an yrange parameters and multiplying the values by the appropriate amounts)?

Answer

Woltan picture Woltan · Jun 27, 2011

There are two ways that I can think of:

  1. You could make use of set xtics (see documentation here)
    Then you can explicitly specify what value on your axis will receive which label. So something like this:

    set xtics ("0" 0, "10" 1e-9, "20" 2e-9, ...)
    

    should work. Proceed accordingly with the y axis (set ytics)

  2. You could multiply your values accordingly. (Like what you have mentioned in your question)

    plot "Data.dat" u ($1*1e9):($2*1e2)