优雅地为gnuplot vectorplot创建参考向量

优雅地为gnuplot vectorplot创建参考向量,gnuplot,Gnuplot,假设我有一个gnuplot脚本来创建向量图,例如,见下文 s=0.2 set terminal wxt persist set xrange [-1:1] set yrange [-1:1] set size ratio -1 set samples 10 set key outside plot '++' using 1:2:($2*s):(-$1*s) with vectors title "1 [m/s]" 如您所见,我重新缩放了向量的分量,使向量图看起来很漂亮。现在,我想创建一个给

假设我有一个gnuplot脚本来创建向量图,例如,见下文

s=0.2
set terminal wxt persist
set xrange [-1:1]
set yrange [-1:1]
set size ratio -1
set samples 10
set key outside 
plot '++' using 1:2:($2*s):(-$1*s) with vectors title "1 [m/s]" 

如您所见,我重新缩放了向量的分量,使向量图看起来很漂亮。现在,我想创建一个给定长度的参考向量,我可以在域外绘制。我正在寻找一种优雅的解决方案,它不依赖于额外的线条来绘制,最好可以像
设置颜色框那样方便地进行控制。

您可以使用
设置箭头来实现这一点。为了获得正确的缩放比例,您可以使用长度为
1

set arrow from graph 1.1,first -1 to graph 1.1, first 0
使用第一个y轴作为垂直长度的。如果要在一个点上定义箭头,可以始终使用
对其求值:

set macros
myarrow = 'set arrow from graph 1.1,first -1 to graph 1.1, first 0'
... a lot of code ...
@myarrow

设置箭头有什么问题?@Christoph为什么我没有想到这一点?你能建议一个正确缩放的智能方法吗?谢谢,有了你的代码,我必须从图1.1,首先-1*s将其设置为
。通过在缩放向量之前使用适当的变量,使其更通用可能比您想象的更容易。再次感谢。