【发布时间】:2017-12-26 01:36:27
【问题描述】:
例子:
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,因为我想创建一个从子图到子图的箭头)。
【问题讨论】:
-
这真的是 Julia 代码吗?我从 Plots 和 PyPlot 中看到的样本看起来完全不同
-
我不太确定你所说的“Julia”代码是什么意思。介意解释吗?此代码在 Julia 控制台中 100% 运行,所有命令均不返回错误,所有命令都为您提供您所期望的:对象或方法等(来自 PyCall 的 Python 类型)。据我所知,这是有效的。唯一的问题是这些变化没有反映在图中。无论如何,我的问题不在于我的代码是否正确;我不在乎那个。我只关心是否有办法在 Julia 中使用 PyPlot.jl 向 matplotlib 图添加补丁。
-
当我将您的代码粘贴到 Julia 0.6 中时,每一行都会报告一个错误。我想念“使用绘图”;使用“PyPlot”等等
-
你显然已经在使用
PyPlot...我的问题是关于使用 PyPlot 实现这一点,所以在不加载它的情况下运行我的代码是没有意义的...@987654324 @ 已添加到我的示例中。
标签: matplotlib julia patch