锚定Box03 1234567891011121314from matplotlib.patches import Ellipseimport matplotlib.pyplot as pltfrom mpl_toolkits.axes_grid1.anchored_artists import AnchoredAuxTransformBoxfig, ax = plt.subplots(figsize=(3, 3))box = AnchoredAuxTransformBox(ax.transData, loc='upper left')el = Ellipse((0, 0), width=0.1, height=0.4, angle=30) # in data coordinates!box.drawing_area.add_artist(el)ax.add_artist(box)plt.show() 下载这个示例 下载python源码: anchored_box03.py 下载Jupyter notebook: anchored_box03.ipynb