MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / annotate

Function annotate

galleries/examples/showcase/anatomy.py:61–82  ·  view source on GitHub ↗
(x, y, text, code)

Source from the content-addressed store, hash-verified

59# Annotate the figure
60
61def annotate(x, y, text, code):
62 # Circle marker
63 c = Circle((x, y), radius=0.15, clip_on=False, zorder=10, linewidth=2.5,
64 edgecolor=royal_blue + [0.6], facecolor='none',
65 path_effects=[withStroke(linewidth=7, foreground='white')])
66 ax.add_artist(c)
67
68 # use path_effects as a background for the texts
69 # draw the path_effects and the colored text separately so that the
70 # path_effects cannot clip other texts
71 for path_effects in [[withStroke(linewidth=7, foreground='white')], []]:
72 color = 'white' if path_effects else royal_blue
73 ax.text(x, y-0.2, text, zorder=100,
74 ha='center', va='top', weight='bold', color=color,
75 style='italic', fontfamily='monospace',
76 path_effects=path_effects)
77
78 color = 'white' if path_effects else 'black'
79 ax.text(x, y-0.33, code, zorder=100,
80 ha='center', va='top', weight='normal', color=color,
81 fontfamily='monospace', fontsize='medium',
82 path_effects=path_effects)
83
84
85annotate(3.5, -0.13, "Minor tick label", "ax.xaxis.set_minor_formatter")

Callers 1

anatomy.pyFile · 0.70

Calls 3

CircleClass · 0.90
add_artistMethod · 0.45
textMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…