Gnuplot:如何使用x1y2轴绘制箭头

Gnuplot:如何使用x1y2轴绘制箭头,gnuplot,axes,Gnuplot,Axes,我们可以使用以下方法绘制箭头: set arrow 1 from 0,-5 to 0,5 但是,“从”和“到”位置使用x1y1轴 如何让位置使用x1y2轴?我的y2轴与y1轴不同。使用第二坐标系: # Set different ranges for y1 and y2 set y2range [-1:1]; set yrange [-10:10]; set xrange [-2*pi:2*pi]; set y2tics set multiplot layout 2,1 # Set arrow

我们可以使用以下方法绘制箭头:

set arrow 1 from 0,-5 to 0,5
但是,“从”和“到”位置使用x1y1轴


如何让位置使用x1y2轴?我的y2轴与y1轴不同。

使用
第二坐标系:

# Set different ranges for y1 and y2
set y2range [-1:1]; set yrange [-10:10]; set xrange [-2*pi:2*pi]; set y2tics
set multiplot layout 2,1
# Set arrow using x1y1 coordinate system
set arrow 1 from 0,0 to 1,1
plot sin(x)
# Set arrow using x2y2 coordinate system (x2 = x1 because x2 is not set)
set arrow 1 from second 0,0 to second 1,1
plot sin(x)
您可以看到不同之处:


但是,如果未设置X2,则X2不会从X继承完全相同的内容,例如,如果您设置了扩展数据时间
。如果要对箭头使用相同的时间格式,也必须手动设置。更重要的是,如果关闭了X2 tics(对于更清晰的图形),X2比例可能不完全相同,因此箭头将四处移动,或者有时位置略有不同。您可能需要执行以下操作:-

set x2data time                        ; # So we can ref second
set x2range [GPVAL_X_MIN:GPVAL_X_MAX]  ; # But X2 needs exactly the same exact scale (set x2tics is another way)
set arrow 2 from second "201710300000",5050  to second "201710282330",5590