Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
987 views
in Technique[技术] by (71.8m points)

plot - How to scale the axis in Gnuplot

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...