Gnuplot,如何在绘制文件数据的同时将x反转为y? [英] Gnuplot, how to invert x with y while plotting file data?

查看:128
本文介绍了Gnuplot,如何在绘制文件数据的同时将x反转为y?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个'data.txt'文件,包含两列和N行,对应于N个点,例如

  0.2 0.3 
0.4 0.6
0.1 0.7
0.9 0.6

如果我使用 Gnuplot 来绘制这个文件中的数据,使用命令

  plot datafile.txt与lp 

它绘制默认形式(X,Y)中的每个点,那就是 Gnuplot 将第一列解释为所有X值,第二列解释为所有Y值。

我想颠倒X和Y的含义。我想设置 Gnuplot 这个命令:把第一列作为Y,第二列作为X
因此,我希望 Gnuplot 从(Y,X)等文件中提取所有数据并将它们绘制为(X,Y)。



我怎么能这样做?

Thanx

解决方案

  gnuplot>使用将使您可以使用./data.txt使用2:1与lp 

从您的数据中选择任意列。


I have a 'data.txt' file containing two columns and N rows, corresponding to N points, e.g.

0.2 0.3
0.4 0.6
0.1 0.7
0.9 0.6

If I use Gnuplot to plot data from this file, using the command

plot "datafile.txt" with lp

it plots every point in the default form (X, Y), that is Gnuplot interprets the first column as all the X values, and the second column as all the Y values.

I would like to invert the meaning of X and Y. I would like to set Gnuplot this command: "Take the first column as Y, and the second column as X" And so I would like Gnuplot to take all the data from file like (Y,X) and plot them as (X,Y).

How could I do this?

Thanx

解决方案

gnuplot> plot "./data.txt" using 2:1 with lp

"using" will allow you to select arbitrary columns from your data.

这篇关于Gnuplot,如何在绘制文件数据的同时将x反转为y?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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