当前位置: 首页>>代码示例>>Python>>正文


Python pyplot.barbs方法代码示例

本文整理汇总了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) 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:14,代码来源:test_streamplot.py

示例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) 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:14,代码来源:test_collections.py

示例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]) 
开发者ID:cwebster2,项目名称:pyMeteo,代码行数:8,代码来源:skewt.py

示例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) 
开发者ID:cwebster2,项目名称:pyMeteo,代码行数:6,代码来源:skewt.py

示例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) 
开发者ID:cwebster2,项目名称:pyMeteo,代码行数:6,代码来源:skewt.py

示例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() 
开发者ID:cwebster2,项目名称:pyMeteo,代码行数:52,代码来源:skewt.py


注:本文中的matplotlib.pyplot.barbs方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。