本文整理匯總了Python中matplotlib.pyplot.barbs方法的典型用法代碼示例。如果您正苦於以下問題:Python pyplot.barbs方法的具體用法?Python pyplot.barbs怎麽用?Python pyplot.barbs使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類matplotlib.pyplot
的用法示例。
在下文中一共展示了pyplot.barbs方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_streamplot_limits
# 需要導入模塊: from matplotlib import pyplot [as 別名]
# 或者: from matplotlib.pyplot import barbs [as 別名]
def test_streamplot_limits():
ax = plt.axes()
x = np.linspace(-5, 10, 20)
y = np.linspace(-2, 4, 10)
y, x = np.meshgrid(y, x)
trans = mtransforms.Affine2D().translate(25, 32) + ax.transData
plt.barbs(x, y, np.sin(x), np.cos(y), transform=trans)
# The calculated bounds are approximately the bounds of the original data,
# this is because the entire path is taken into account when updating the
# datalim.
assert_array_almost_equal(ax.dataLim.bounds, (20, 30, 15, 6),
decimal=1)
示例2: test_barb_limits
# 需要導入模塊: from matplotlib import pyplot [as 別名]
# 或者: from matplotlib.pyplot import barbs [as 別名]
def test_barb_limits():
ax = plt.axes()
x = np.linspace(-5, 10, 20)
y = np.linspace(-2, 4, 10)
y, x = np.meshgrid(y, x)
trans = mtransforms.Affine2D().translate(25, 32) + ax.transData
plt.barbs(x, y, np.sin(x), np.cos(y), transform=trans)
# The calculated bounds are approximately the bounds of the original data,
# this is because the entire path is taken into account when updating the
# datalim.
assert_array_almost_equal(ax.dataLim.bounds, (20, 30, 15, 6),
decimal=1)
示例3: plot_wind_axes
# 需要導入模塊: from matplotlib import pyplot [as 別名]
# 或者: from matplotlib.pyplot import barbs [as 別名]
def plot_wind_axes(axes):
# plot wind barbs
# TODO: also do storm-relative winds
draw_wind_line(axes)
axes.set_axis_off()
axes.axis([-1,1,pbot,ptop])
示例4: plot_wind
# 需要導入模塊: from matplotlib import pyplot [as 別名]
# 或者: from matplotlib.pyplot import barbs [as 別名]
def plot_wind(axes, z, p, u, v, x=0):
for i in np.arange(0,len(z),1):
if (p[i] > pt_plot):
plt.barbs(x,p[i],u[i],v[i], length=5, linewidth=.5)
示例5: plot_wind_barbs
# 需要導入模塊: from matplotlib import pyplot [as 別名]
# 或者: from matplotlib.pyplot import barbs [as 別名]
def plot_wind_barbs(axes, z, p, u, v):
for i in np.arange(0,len(z)):
if (p[i] > pt_plot):
plt.barbs(0,p[i],u[i],v[i], length=5, linewidth=.5)
示例6: plot
# 需要導入模塊: from matplotlib import pyplot [as 別名]
# 或者: from matplotlib.pyplot import barbs [as 別名]
def plot(loc, z, th, p, qv, u, v, output, time = None, title = None):
"""Plots Skew-T/Log-P diagrapms with hodograph
The helper functions above facilitate loading data from
various formats and then call this function. If you have
data in another format or arrays of data in python already,
then this is the function you want to use.
:parameter loc: Location string
:parameter z: z grid mesh (1D)
:parameter time: Time string
:parameter th: Potential temperature at z points
:parameter p: Pressure at z points
:parameter qv: Water vapor mixing ratio at z points
:parameter u: u winds at z points
:parameter v: v winds at z points
:parameter title: Title for plot
:parameter output: Filename to save plot to
"""
fig = plt.figure(1, figsize=(10, 8), dpi=300, edgecolor='k')
# sounding
ax1 = plt.subplot(121)
plot_sounding_axes(ax1)
plot_sounding(ax1, z, th, p, qv, None, None)
# hodograph
ax2 = plt.subplot(222)
plot_hodo_axes(ax2)
plot_hodograph(ax2, z, u, v)
# datablock
ax3 = fig.add_subplot(224)
try:
plot_datablock(ax3, loc, z, time, th, p, qv, u, v, title)
except:
print("Error calcualting sounding stats, datablock omitted");
# wind barbs
ax4 = fig.add_subplot(132)
plot_wind_axes(ax4)
plot_wind_barbs(ax4,z,p,u,v)
# legend
ax5 = fig.add_subplot(4,4,15)
plot_legend(ax5)
# Adjust plot margins.
plt.subplots_adjust(left=0.03, bottom=0.03, right=0.97, top=0.97, wspace=0.12, hspace=0.12)
plt.savefig(output, dpi=300,bbox_inches=0)
plt.close()