Gnuplot, how to invert x with y while plotting file data?

非 Y 不嫁゛ 提交于 2019-12-11 10:25:12

问题


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


回答1:


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

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



来源:https://stackoverflow.com/questions/8623856/gnuplot-how-to-invert-x-with-y-while-plotting-file-data

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!