锚定Box03

锚定Box03示例

  1. from matplotlib.patches import Ellipse
  2. import matplotlib.pyplot as plt
  3. from mpl_toolkits.axes_grid1.anchored_artists import AnchoredAuxTransformBox
  4. fig, ax = plt.subplots(figsize=(3, 3))
  5. box = AnchoredAuxTransformBox(ax.transData, loc='upper left')
  6. el = Ellipse((0, 0), width=0.1, height=0.4, angle=30) # in data coordinates!
  7. box.drawing_area.add_artist(el)
  8. ax.add_artist(box)
  9. plt.show()

下载这个示例