1

我正在修改我们在 unidata metpy 培训课程中使用的 skew-t notebook。有没有办法在包含信息的 skew-t 上或旁边放置一个文本框。(CAPE = xx,LCL 是 XX,等等。)我知道我们做了子图,但我认为 skew-t 是一种特殊的图形,可能有不同的规则?

4

1 回答 1

1

MetPy 中的SkewT对象是一个特殊的东西,但它有一个.ax属性是标准的 Matplotlib 轴,您可以正常使用,包括使用 matplotlib 的text()绘图命令:

fig = plt.figure(figsize=(9, 9))
skew = SkewT(fig, rotation=45)

# Plot the data using normal plotting functions, in this case using
# log scaling in Y, as dictated by the typical meteorological plot
skew.plot(p, T, 'r')
skew.plot(p, Td, 'g')
skew.plot_barbs(p, u, v)
skew.ax.set_ylim(1000, 100)
skew.ax.set_xlim(-40, 60)

# these are matplotlib.patch.Patch properties
props = dict(boxstyle='round', facecolor='wheat', alpha=0.5)

# place a text box in upper left in axes coords
skew.ax.text(0.05, 0.95, 'LCL: 757mb', transform=skew.ax.transAxes,
             fontsize=14, verticalalignment='top', bbox=props)
于 2018-11-10T00:00:50.947 回答