How to scale the axis in Gnuplot

21,954

Have a look at this question; perhaps it will help.

In your case I expect you want something like

set xdata time
set timefmt "%M"
set format x "%H:%M"

These commands tell gnuplot you are providing timedata in the form of minutes, but you want them displayed with hours and minutes.

EDIT (see comments): (ignoring the time formatting) Scaling the axis of a data file data.dat can be achieved as follows:

plot "data.dat" using ($1/60):2 with lines

The $1 is the column that you want to scale, which you manipulate with maths operations. You usually need to wrap the whole expression in parenthesis before the moving onto other columns.

Share:
21,954
sfactor
Author by

sfactor

Dreamer, Analyst, Engineer, Programmer, Photographer.

Updated on September 25, 2020

Comments

  • sfactor
    sfactor over 3 years

    I have a data set that has two tab delimited columns that I plot in a simple XY axis. The independent variable (x axis) is duration in minutes. What I want is to plot this in hours instead of minutes. How would I apply this scaling in gnuplot while plotting?

  • sfactor
    sfactor over 13 years
    my problem is actually quite simple than this I think. The duration column is already in the minute form (12.00, 15.00, 20.50 etc.). What I want is just to be able to plot this by scaling this by 60 (for hours).
  • Tom
    Tom over 13 years
    I'm not certain what you mean. If you mean "divide the x column by 60" then you can do this as follows: "plot "./data.dat" using ($1/60):2 with line. If you want 74 to be displayed as 01:14 then the above answer is what you want