anchored_box01
锚定Box01 123456789101112import matplotlib.pyplot as pltfrom matplotlib.offsetbox import AnchoredTextfig, ax = plt.subplots(figsize=(3, 3))at = AnchoredText("Figure 1a", prop=dict(size=15), frameon=True, loc='upper left')at.patch.set_boxstyle("round,pad=0.,rounding_size=0.2")ax.add_artist(at)plt.show() 下载这个示例 下载python源码: anchored_box01.py 下载Jupyter notebook: anchored_box01.ipynb
anchored_box02
锚定Box02 1234567891011121314151617from matplotlib.patches import Circleimport matplotlib.pyplot as pltfrom mpl_toolkits.axes_grid1.anchored_artists import AnchoredDrawingAreafig, ax = plt.subplots(figsize=(3, 3))ada = AnchoredDrawingArea(40, 20, 0, 0, loc='upper right', pad=0., frameon=False)p1 = Circle((10, 10), 10)ada.drawing_area.add_artist(p1)p2 = Circle((30, 10), 5, fc="r")ada.drawing_area.add_artist(p2)ax.add_artist(ada)plt.show() 下载这个示例 下载py...
anchored_box03
锚定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
annotate_explain
注释说明 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576import matplotlib.pyplot as pltimport matplotlib.patches as mpatchesfig, axs = plt.subplots(2, 2)x1, y1 = 0.3, 0.3x2, y2 = 0.7, 0.7ax = axs.flat[0]ax.plot([x1, x2], [y1, y2], ".")el = mpatches.Ellipse((x1, y1), 0.3, 0.4, angle=30, alpha=0.2)ax.add_artist(el)ax.annotate("", xy=(x1, y1), xycoords='data', ...
annotate_simple01
注释Simple01 12345678910111213import matplotlib.pyplot as pltfig, ax = plt.subplots(figsize=(3, 3))ax.annotate("", xy=(0.2, 0.2), xycoords='data', xytext=(0.8, 0.8), textcoords='data', arrowprops=dict(arrowstyle="->", connectionstyle="arc3"), )plt.show() 下载这个示例 下载python源码: annotate_simple01.py 下载Jupyter notebook: annotate_simple01.ipynb
anchored_box04
锚定Box04 12345678910111213141516171819202122232425262728293031323334from matplotlib.patches import Ellipseimport matplotlib.pyplot as pltfrom matplotlib.offsetbox import (AnchoredOffsetbox, DrawingArea, HPacker, TextArea)fig, ax = plt.subplots(figsize=(3, 3))box1 = TextArea(" Test : ", textprops=dict(color="k"))box2 = DrawingArea(60, 20, 0, 0)el1 = Ellipse((10, 10), width=16, height=5, angle=30, fc="r")el2 = Ellipse((30, 10), width...
annotate_simple02
注释Simple02 1234567891011121314import matplotlib.pyplot as pltfig, ax = plt.subplots(figsize=(3, 3))ax.annotate("Test", xy=(0.2, 0.2), xycoords='data', xytext=(0.8, 0.8), textcoords='data', size=20, va="center", ha="center", arrowprops=dict(arrowstyle="simple", connectionstyle="arc3,rad=-0.2"), )plt.show() 下载这个示例 下载python源码: annotate_simple02....
annotate_simple03
注释Simple03 12345678910111213141516import matplotlib.pyplot as pltfig, ax = plt.subplots(figsize=(3, 3))ann = ax.annotate("Test", xy=(0.2, 0.2), xycoords='data', xytext=(0.8, 0.8), textcoords='data', size=20, va="center", ha="center", bbox=dict(boxstyle="round4", fc="w"), arrowprops=dict(arrowstyle="-|>", ...
annotate_simple04
注释Simple04 12345678910111213141516171819202122232425262728import matplotlib.pyplot as pltfig, ax = plt.subplots(figsize=(3, 3))ann = ax.annotate("Test", xy=(0.2, 0.2), xycoords='data', xytext=(0.8, 0.8), textcoords='data', size=20, va="center", ha="center", bbox=dict(boxstyle="round4", fc="w"), arrowprops=dict(arrowstyle="-|>",...
annotate_simple_coord01
简单Coord01注释示例 123456789101112import matplotlib.pyplot as pltfig, ax = plt.subplots(figsize=(3, 2))an1 = ax.annotate("Test 1", xy=(0.5, 0.5), xycoords="data", va="center", ha="center", bbox=dict(boxstyle="round", fc="w"))an2 = ax.annotate("Test 2", xy=(1, 0.5), xycoords=an1, xytext=(30, 0), textcoords="offset points", va="center", ha=&quo...














