Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 27a3ca9

Browse files
committed
DOC: Add patches and link to transformations in quickstart guide
1 parent 7506d1a commit 27a3ca9

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

doc/users/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ General
1414
:maxdepth: 2
1515

1616
getting_started/index.rst
17+
Quick-start guide <explain/quick_start>
1718
installing/index.rst
1819
explain/index.rst
1920
faq/index.rst

galleries/users_explain/quick_start.py

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,8 @@
206206
# You may find older examples that use the ``pylab`` interface,
207207
# via ``from pylab import *``. This approach is strongly deprecated.
208208
#
209-
# Making a helper functions
210-
# -------------------------
209+
# Making helper functions
210+
# -----------------------
211211
#
212212
# If you need to make the same plots over and over again with different data
213213
# sets, or want to easily wrap Matplotlib methods, use the recommended
@@ -558,8 +558,29 @@ def my_plotter(ax, data1, data2, param_dict):
558558
# control the size. Finally, the colorbar will have default locators
559559
# and formatters appropriate to the norm. These can be changed as for
560560
# other Axis objects.
561+
562+
# %%
563+
# Patches
564+
# =======
561565
#
562-
#
566+
# Patches are Artists with a face color and an edge color, which can be used to
567+
# draw arbitrary two dimensional regions. In addition to the more general
568+
# Polygon, there are wrappers and helpers for common shapes like Rectangles,
569+
# Circles, Boxes, Ellipses, and more.
570+
571+
fig, ax = plt.subplots()
572+
573+
polygon = mpl.patches.Polygon(np.array([[1, 0], [0.5, 1.5], [2, 1]]), closed=True)
574+
ax.add_patch(polygon)
575+
576+
circle = mpl.patches.Circle((2, 2), 0.5, facecolor='orange', edgecolor='black')
577+
ax.add_patch(circle)
578+
579+
ax.set_xlim(0, 3)
580+
ax.set_ylim(0, 3)
581+
ax.set_box_aspect(1)
582+
583+
# %%
563584
# Working with multiple Figures and Axes
564585
# ======================================
565586
#
@@ -588,3 +609,6 @@ def my_plotter(ax, data1, data2, param_dict):
588609
# For more plot types see :doc:`Plot types </plot_types/index>` and the
589610
# :doc:`API reference </api/index>`, in particular the
590611
# :doc:`Axes API </api/axes_api>`.
612+
#
613+
# For more information on coordinate systems and transformations, see the
614+
# :ref:`transforms_tutorial`.

0 commit comments

Comments
 (0)