锚定Box02

锚定Box02示例

  1. from matplotlib.patches import Circle
  2. import matplotlib.pyplot as plt
  3. from mpl_toolkits.axes_grid1.anchored_artists import AnchoredDrawingArea
  4. fig, ax = plt.subplots(figsize=(3, 3))
  5. ada = AnchoredDrawingArea(40, 20, 0, 0,
  6. loc='upper right', pad=0., frameon=False)
  7. p1 = Circle((10, 10), 10)
  8. ada.drawing_area.add_artist(p1)
  9. p2 = Circle((30, 10), 5, fc="r")
  10. ada.drawing_area.add_artist(p2)
  11. ax.add_artist(ada)
  12. plt.show()

下载这个示例