如何在Gnuplot中缩放轴 [英] How to scale the axis in Gnuplot

查看:314
本文介绍了如何在Gnuplot中缩放轴的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个数据集,该数据集有两个用制表符分隔的列,它们在一个简单的XY轴上绘制.自变量(x轴)是持续时间(以分钟为单位).我要绘制的是小时数而不是分钟数.绘图时如何在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?

推荐答案

看看

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"

这些命令告诉gnuplot您以分钟的形式提供时间数据, 但您希望它们以小时和分钟显示.

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

编辑(请参见注释):(忽略时间格式)缩放数据文件data.dat的轴可以如下实现:

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

$1是要缩放的列,可以使用数学运算进行操作. 在移至其他列之前,通常需要将整个表达式用括号括起来.

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.

这篇关于如何在Gnuplot中缩放轴的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆