在gnuplot中移动箭头

时间:2015-11-25 16:07:22

标签: gnuplot

我画了一条需要箭头的线。我有结束坐标,但因为那里有一个小球体,它应该只移动一点点。如果没有手动计算新坐标(这真的很痛苦),如何做到这一点的任何想法。也许更改箭头定义?

enter image description here

#the arrow with heads that need to be shifted
set style arrow 5 heads filled size screen 0.03,15,45 ls 10
set arrow from 0.0, -1.0, -2.1908902300206643 to 0., 1., 0. ls 10 as 5

#the line itself:
set arrow from 0.0, -1.0, -2.1908902300206643 to 0., 1., 0. nohead ls 3

1 个答案:

答案 0 :(得分:1)

让我手动计算新坐标:)

假设箭头的2D端点由a=(ax,ay)b=(bx,by)给出。包含点(rx,ry)a的任何行的坐标b都可以从公式计算

rx(t) = (1-t)*ax + t*bx
ry(t) = (1-t)*ay + t*by

其中t是实数。请注意r(0)=ar(1)=b,因此原始箭头可以绘制为

set arrow from rx(0),ry(0) to rx(1),ry(1)

要缩短(或放大)此箭头,您可以使用相同的指令,使t的值不同于0或1.例如:

eps=0.1
set arrow from rx(eps),ry(eps) to rx(1-eps),ry(1-eps)   #shortened both sides
set arrow from rx(0),ry(0) to rx(1-eps),ry(1-eps)       #shortened just the end-point
set arrow from rx(0),ry(0) to rx(1+eps),ry(1+eps)       #enlarged just the end-point