如何使用Julia的PyPlot.jl为图形添加补丁

时间:2017-07-20 11:23:21

标签: matplotlib julia patch

示例:

using PyPlot
fig = gcf(); ax0=subplot(2,2,2)
ax1 = subplot(2,2,4)
ax0tr = ax0[:transAxes]; ax1tr = ax1[:transAxes] 
figtr = fig[:transFigure]
# 2. Transform arroww start point from axis 0 to figure coordinates
ptB = figtr[:transform](ax0tr[:transform]((20., -0.5)))
# 3. Transform arroww end point from axis 1 to figure coordinates
ptE = figtr[:transform](ax1tr[:transform]((20., 1.)))
# 4. Create the patch
arroww = matplotlib[:patches][:FancyArrowPatch](
ptB, ptE, transform=figtr,  # Place arroww in figure coord system
fc = "C0", alpha = 0.25, connectionstyle="arc3,rad=0.2",
arrowstyle="simple",
mutation_scale = 40.0)
# 5. Add patch to list of objects to draw onto the figure
push!(fig[:patches], arroww)
fig[:show]()

如何将贴片对象添加到图形中并在图形上实际看到它?这不起作用。它没有抛出任何错误,但我看不到任何箭头。

(我也不能使用函数arrow,因为我想创建一个从子图到子图的箭头。

0 个答案:

没有答案