在gnuplot中交换轴 [英] Exchanging the axes in gnuplot

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

问题描述

我一直在想这个问题,它可能已经在gnuplot中实现,但是我无法在线查找信息.

I have been wondering about this for a while, and it might already be implemented in gnuplot but I haven't been able to find info online.

当您有一个数据文件时,可以交换轴并为垂直轴分配虚拟变量",例如x(在gnuplot的帮助术语中):

When you have a data file, it is possible to exchange the axes and assign the "dummy variable", say x, (in gnuplot's help terminology) to the vertical axis:

plot "data" u 1:2 # x goes to horizontal axis, standard
plot "data" u 2:1 # x goes to vertical axis, exchanged axes

但是,当您拥有一个函数时,您需要借助参数函数来执行此操作.假设您要绘制x =y²(与y =x²相反),然后(据我所知)您需要做:

However, when you have a function, you need to resort to a parametric function to do this. Imagine you want to plot x = y² (as opposite to y = x²), then (as far as I know) you need to do:

set parametric
plot t**2,t

在这种情况下效果很好.但是我认为,更灵活的方法是可取的,例如

which works nicely in this case. I think however that a more flexible approach would be desirable, something like

plot x**2 axes y1x1 # this doesn't work!

是否实现了上述类似功能,还是有一种简单的方法可以将y用作虚拟变量而无需set parametric?

Is something like the above implemented, or is there an easy way to use y as dummy variable without the need to set parametric?

推荐答案

这是另一个丑陋但仅限gnuplot的变体:使用特殊的文件名'+'生成用于绘制的动态数据集:

So here is another ugly, but gnuplot-only variant: Use the special filename '+' to generate a dynamic data set for plotting:

plot '+' using ($1**2):1

开发版本包含一项新功能,该功能允许您使用虚拟变量而不是列号来进行'+'绘制:

The development version contains a new feature, which allows you to use dummy variables instead of column numbers for plotting with '+':

plot sample [y=-10:10] '+' using (y**2):(y)

我想那是最接近您要求的东西.

I guess that's what come closest to your request.

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

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