我想作一个没有箭头的箭袋图。我还希望有边框,以便箭头可以从背景色图中突出。这是我的代码试图生成这样的图的主要部分:
plt.quiver(phia[sl1,sl2], R0a[sl1,sl2],u,v, color='white', headlength=0, headwidth = 1, pivot = 'middle', scale = scale, width=width, linewidth = 0.5)
Run Code Online (Sandbox Code Playgroud)
如果这很重要,则图在极轴上。这适用于大多数行,但非常短的行除外。在这些情况下,在线条之后会产生一些来自边界的人造尾巴。我生成的受此影响最大的图之一如下:
任何对此问题的解决方案或绕过它的建议将不胜感激!谢谢!
headaxislength
将箭头的参数指定为零即可达到目的:
import numpy as np
import matplotlib.pyplot as plt
theta = np.linspace(0, 2*np.pi, 16)
r = np.linspace(0, 1, 6)
x = np.cos(theta)[:,np.newaxis]*r
y = np.sin(theta)[:,np.newaxis]*r
quiveropts = dict(color='white', headlength=0, pivot='middle', scale=3,
linewidth=.5, units='xy', width=.05, headwidth=1) # common options
f, (ax1, ax2) = plt.subplots(1,2, sharex=True, sharey=True)
ax1.quiver(x,y, -y, x, headaxislength=4.5, **quiveropts) # the default
ax2.quiver(x,y, -y, x, headaxislength=0, **quiveropts)
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
2743 次 |
最近记录: |