diff --git a/tutorials/provisional/mosaic.py b/tutorials/provisional/mosaic.py index 9aa06c9520e1..05623e852ed7 100644 --- a/tutorials/provisional/mosaic.py +++ b/tutorials/provisional/mosaic.py @@ -105,7 +105,7 @@ def identify_axes(ax_dict, fontsize=48): # String short-hand # ================= # -# By restricting our axes labels to single characters we can use Using we can +# By restricting our axes labels to single characters we can # "draw" the Axes we want as "ASCII art". The following @@ -123,14 +123,30 @@ def identify_axes(ax_dict, fontsize=48): ax_dict = fig.subplot_mosaic(mosaic) identify_axes(ax_dict) +############################################################################### +# Alternatively, you can use the more compact string notation +mosaic = "AB;CD" + +############################################################################### +# will give you the same composition, where the ``";"`` is used +# as the row separator instead of newline. + +fig = plt.figure(constrained_layout=True) +ax_dict = fig.subplot_mosaic(mosaic) +identify_axes(ax_dict) ############################################################################### +# Axes spanning multiple rows/columns +# =================================== +# # Something we can do with `.Figure.subplot_mosaic` that you can not # do with `.Figure.subplots` is specify that an Axes should span # several rows or columns. -# -# If we want to re-arrange our four Axes to have C be a horizontal -# span on the bottom and D be a vertical span on the right we would do + + +############################################################################### +# If we want to re-arrange our four Axes to have ``"C"`` be a horizontal +# span on the bottom and ``"D"`` be a vertical span on the right we would do axd = plt.figure(constrained_layout=True).subplot_mosaic( """