Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ffd3b12

Browse filesBrowse files
authored
Merge pull request #25934 from saranti/annotate_figure
DOC: Fix figure annotation example
2 parents 645a9a9 + d58182a commit ffd3b12
Copy full SHA for ffd3b12

File tree

Expand file treeCollapse file tree

1 file changed

+8
-7
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+8
-7
lines changed

‎galleries/examples/text_labels_and_annotations/annotation_demo.py

Copy file name to clipboardExpand all lines: galleries/examples/text_labels_and_annotations/annotation_demo.py
+8-7Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
# any key for matplotlib.patches.polygon (e.g., facecolor)
5454

5555
# Create our figure and data we'll use for plotting
56-
fig, ax = plt.subplots(figsize=(3, 3))
56+
fig, ax = plt.subplots(figsize=(4, 4))
5757

5858
t = np.arange(0.0, 5.0, 0.01)
5959
s = np.cos(2*np.pi*t)
@@ -63,7 +63,8 @@
6363
ax.annotate('figure pixels',
6464
xy=(10, 10), xycoords='figure pixels')
6565
ax.annotate('figure points',
66-
xy=(80, 80), xycoords='figure points')
66+
xy=(107, 110), xycoords='figure points',
67+
fontsize=12)
6768
ax.annotate('figure fraction',
6869
xy=(.025, .975), xycoords='figure fraction',
6970
horizontalalignment='left', verticalalignment='top',
@@ -72,14 +73,14 @@
7273
# The following examples show off how these arrows are drawn.
7374

7475
ax.annotate('point offset from data',
75-
xy=(2, 1), xycoords='data',
76-
xytext=(-15, 25), textcoords='offset points',
76+
xy=(3, 1), xycoords='data',
77+
xytext=(-10, 90), textcoords='offset points',
7778
arrowprops=dict(facecolor='black', shrink=0.05),
78-
horizontalalignment='right', verticalalignment='bottom')
79+
horizontalalignment='center', verticalalignment='bottom')
7980

8081
ax.annotate('axes fraction',
81-
xy=(3, 1), xycoords='data',
82-
xytext=(0.8, 0.95), textcoords='axes fraction',
82+
xy=(2, 1), xycoords='data',
83+
xytext=(0.36, 0.68), textcoords='axes fraction',
8384
arrowprops=dict(facecolor='black', shrink=0.05),
8485
horizontalalignment='right', verticalalignment='top')
8586

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.