如何在gnuplot中标记矢量 [英] How to label vector in gnuplot

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

问题描述

我想知道如何在gnuplot中向量的末尾给标签.我知道可以在gnuplot中使用"set"在某个位置显示某个标签,但是我要绘制数百个矢量,并且我想在每个矢量的末尾显示索引,例如"Node n" .因此,我想知道是否可以在带有相应向量的一步"中显示带有增量索引的标签.

I would like to know how to give a label at the end of a vector in gnuplot. I know it is possible to use "set" in gnuplot to show a certain label at some place, but I have hundreds of vectors to draw, and I want to show the index of each vector at its end, e.g., "Node n". Thus I wonder if it is possible to show the labels with incremental index in "one step" with corresponding vectors.

我的操作系统是Ubuntu 13.04 32位版本.感谢您的任何建议!

My OS is Ubuntu 13.04 32bit version. Thanks for any advice!

推荐答案

假设您有一个包含以下数据的文件(我将其命名为"temp"),其中前两个坐标是原点,后两个坐标是向量的x和y分量(投影):

Imagine you have a file with the following data (which I named "temp"), where the first two coordinates are the origin and the last two coordinates are the x and y components (projections) of your vector:

0 0 1 1
0 0 1 2
0 0 1 3
0 0 1 4
0 0 1 5

然后您可以使用以下命令执行所需的操作:

Then you can do what you want with the following commands:

set xrange [0:1.2]
set yrange [0:6]
plot "temp" with vectors, "temp" u 3:4:0 with labels left

plot中的第一个实例是绘制与我在数据文件中提到的约定相同的向量,第二个实例是放置坐标x =列3和y =列4的标签(即,在向量的末尾),输入text = column 0(给出数据输入的顺序),然​​后将其从这些坐标向左冲洗.看起来像这样:

The first instance in plot is to plot the vectors with the same convention I mentioned above in the data file, the second instance is to place a label with coordinates x = column 3 and y = column 4 (that is, at the end of your vectors), with text = column 0 (which gives the order of your data entries) and flush it to the left from those coordinates. It looks like this:

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

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