Skip to content

Commit 2006665

Browse files
committed
Clean up figures in annotations tutorials.
Don't scale to 50%, plus some small tweaks to demos so the images fit better.
1 parent 7fe0826 commit 2006665

File tree

2 files changed

+2
-20
lines changed

2 files changed

+2
-20
lines changed

examples/userdemo/connectionstyle_demo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def demo_con_style(ax, connectionstyle):
3030
transform=ax.transAxes, ha="left", va="top")
3131

3232

33-
fig, axs = plt.subplots(3, 5, figsize=(8, 4.8))
33+
fig, axs = plt.subplots(3, 5, figsize=(7, 4), constrained_layout=True)
3434
demo_con_style(axs[0, 0], "angle3,angleA=90,angleB=0")
3535
demo_con_style(axs[1, 0], "angle3,angleA=0,angleB=90")
3636
demo_con_style(axs[0, 1], "arc3,rad=0.")
@@ -48,7 +48,7 @@ def demo_con_style(ax, connectionstyle):
4848

4949
for ax in axs.flat:
5050
ax.set(xlim=(0, 1), ylim=(0, 1), xticks=[], yticks=[], aspect=1)
51-
fig.tight_layout(pad=0.2)
51+
fig.set_constrained_layout_pads(wspace=0, hspace=0, w_pad=0, h_pad=0)
5252

5353
plt.show()
5454

tutorials/text/annotations.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
# .. figure:: ../../gallery/pyplots/images/sphx_glr_annotation_basic_001.png
2929
# :target: ../../gallery/pyplots/annotation_basic.html
3030
# :align: center
31-
# :scale: 50
3231
#
3332
# In this example, both the *xy* (arrow tip) and *xytext* locations
3433
# (text location) are in data coordinates. There are a variety of other
@@ -90,7 +89,6 @@
9089
# .. figure:: ../../gallery/pyplots/images/sphx_glr_annotation_polar_001.png
9190
# :target: ../../gallery/pyplots/annotation_polar.html
9291
# :align: center
93-
# :scale: 50
9492
#
9593
# For more on all the wild and wonderful things you can do with
9694
# annotations, including fancy arrows, see :ref:`plotting-guide-annotation`
@@ -114,7 +112,6 @@
114112
# .. figure:: ../../gallery/userdemo/images/sphx_glr_annotate_text_arrow_001.png
115113
# :target: ../../gallery/userdemo/annotate_text_arrow.html
116114
# :align: center
117-
# :scale: 50
118115
#
119116
# `~.Axes.text` takes a *bbox* keyword argument, which draws a box around the
120117
# text::
@@ -153,7 +150,6 @@
153150
# .. figure:: ../../gallery/shapes_and_collections/images/sphx_glr_fancybox_demo_001.png
154151
# :target: ../../gallery/shapes_and_collections/fancybox_demo.html
155152
# :align: center
156-
# :scale: 50
157153
#
158154
# Note that the attribute arguments can be specified within the style
159155
# name with separating comma (this form can be used as "boxstyle" value
@@ -191,7 +187,6 @@
191187
# .. figure:: ../../gallery/userdemo/images/sphx_glr_annotate_simple01_001.png
192188
# :target: ../../gallery/userdemo/annotate_simple01.html
193189
# :align: center
194-
# :scale: 50
195190
#
196191
# The arrow is drawn as follows:
197192
#
@@ -206,7 +201,6 @@
206201
# .. figure:: ../../gallery/userdemo/images/sphx_glr_annotate_explain_001.png
207202
# :target: ../../gallery/userdemo/annotate_explain.html
208203
# :align: center
209-
# :scale: 50
210204
#
211205
# The creation of the connecting path between two points is controlled by
212206
# ``connectionstyle`` key and the following styles are available.
@@ -233,7 +227,6 @@
233227
# .. figure:: ../../gallery/userdemo/images/sphx_glr_connectionstyle_demo_001.png
234228
# :target: ../../gallery/userdemo/connectionstyle_demo.html
235229
# :align: center
236-
# :scale: 50
237230
#
238231
# The connecting path (after clipping and shrinking) is then mutated to
239232
# an arrow patch, according to the given ``arrowstyle``.
@@ -258,7 +251,6 @@
258251
# .. figure:: ../../gallery/text_labels_and_annotations/images/sphx_glr_fancyarrow_demo_001.png
259252
# :target: ../../gallery/text_labels_and_annotations/fancyarrow_demo.html
260253
# :align: center
261-
# :scale: 50
262254
#
263255
# Some arrowstyles only work with connection styles that generate a
264256
# quadratic-spline segment. They are ``fancy``, ``simple``, and ``wedge``.
@@ -271,15 +263,13 @@
271263
# .. figure:: ../../gallery/userdemo/images/sphx_glr_annotate_simple02_001.png
272264
# :target: ../../gallery/userdemo/annotate_simple02.html
273265
# :align: center
274-
# :scale: 50
275266
#
276267
# As with `~.Axes.text`, a box around the text can be drawn using the *bbox*
277268
# argument.
278269
#
279270
# .. figure:: ../../gallery/userdemo/images/sphx_glr_annotate_simple03_001.png
280271
# :target: ../../gallery/userdemo/annotate_simple03.html
281272
# :align: center
282-
# :scale: 50
283273
#
284274
# By default, the starting point is set to the center of the text
285275
# extent. This can be adjusted with ``relpos`` key value. The values
@@ -289,7 +279,6 @@
289279
# .. figure:: ../../gallery/userdemo/images/sphx_glr_annotate_simple04_001.png
290280
# :target: ../../gallery/userdemo/annotate_simple04.html
291281
# :align: center
292-
# :scale: 50
293282
#
294283
# Placing Artist at the anchored location of the Axes
295284
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -366,7 +355,6 @@
366355
# .. figure:: ../../gallery/userdemo/images/sphx_glr_anchored_box04_001.png
367356
# :target: ../../gallery/userdemo/anchored_box04.html
368357
# :align: center
369-
# :scale: 50
370358
#
371359
# Note that unlike the legend, the ``bbox_transform`` is set
372360
# to IdentityTransform by default.
@@ -409,7 +397,6 @@
409397
# .. figure:: ../../gallery/userdemo/images/sphx_glr_annotate_simple_coord01_001.png
410398
# :target: ../../gallery/userdemo/annotate_simple_coord01.html
411399
# :align: center
412-
# :scale: 50
413400
#
414401
# Note that you must ensure that the extent of the coordinate artist (*an1* in
415402
# above example) is determined before *an2* gets drawn. Usually, this means
@@ -439,7 +426,6 @@
439426
# .. figure:: ../../gallery/userdemo/images/sphx_glr_annotate_simple_coord02_001.png
440427
# :target: ../../gallery/userdemo/annotate_simple_coord02.html
441428
# :align: center
442-
# :scale: 50
443429
#
444430
# 5. Sometimes, you want your annotation with some "offset points", not from the
445431
# annotated point but from some other point. `.text.OffsetFrom` is a helper
@@ -448,7 +434,6 @@
448434
# .. figure:: ../../gallery/userdemo/images/sphx_glr_annotate_simple_coord03_001.png
449435
# :target: ../../gallery/userdemo/annotate_simple_coord03.html
450436
# :align: center
451-
# :scale: 50
452437
#
453438
# You may take a look at this example
454439
# :doc:`/gallery/text_labels_and_annotations/annotation_demo`.
@@ -472,7 +457,6 @@
472457
# .. figure:: ../../gallery/userdemo/images/sphx_glr_connect_simple01_001.png
473458
# :target: ../../gallery/userdemo/connect_simple01.html
474459
# :align: center
475-
# :scale: 50
476460
#
477461
# Here, we added the ConnectionPatch to the *figure* (with `~.Figure.add_artist`)
478462
# rather than to either axes: this ensures that it is drawn on top of both axes,
@@ -492,7 +476,6 @@
492476
# .. figure:: ../../gallery/subplots_axes_and_figures/images/sphx_glr_axes_zoom_effect_001.png
493477
# :target: ../../gallery/subplots_axes_and_figures/axes_zoom_effect.html
494478
# :align: center
495-
# :scale: 50
496479
#
497480
# Define Custom BoxStyle
498481
# ~~~~~~~~~~~~~~~~~~~~~~
@@ -518,7 +501,6 @@
518501
# .. figure:: ../../gallery/userdemo/images/sphx_glr_custom_boxstyle01_001.png
519502
# :target: ../../gallery/userdemo/custom_boxstyle01.html
520503
# :align: center
521-
# :scale: 50
522504
#
523505
# Similarly, you can define a custom ConnectionStyle and a custom ArrowStyle.
524506
# See the source code of ``lib/matplotlib/patches.py`` and check

0 commit comments

Comments
 (0)