Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename Mask class and add origin arg to plot methods #203

Merged
merged 10 commits into from Aug 27, 2018
8 changes: 4 additions & 4 deletions docs/plotting.rst
Expand Up @@ -34,7 +34,7 @@ and calls ``plt.gca()`` if no axis is passed in.
You can shift the origin of the region very conveniently while plotting by simply
supplying the ``origin`` pixel coordinates to :meth:`~regions.PixelRegion.plot`
and :meth:`~regions.PixelRegion.as_patch`. The ``**kwargs`` argument takes any
keyword argument that the `~matplotlib.patches.Patch` object accepts. For Ex:
keyword argument that the `~matplotlib.patches.Patch` object accepts. For e.g.:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's just e.g., not For e.g., but I'll handle that

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not know e.g. itself means for example, I thought it is short for example (had to google it!) ..hehe


.. plot::
:include-source:
Expand All @@ -49,9 +49,9 @@ keyword argument that the `~matplotlib.patches.Patch` object accepts. For Ex:
ax.set_ylim([-4, 2])
plt.show()

Note that not all pixel regions have ``as_patch()`` methods, e.g.
the `~regions.TextPixelRegion` and `~regions.CompoundPixelRegion`
don't have because there are no equivalent classes in `matplotlib.patches`.
Pixel regions such as `~regions.TextPixelRegion` and
`~regions.CompoundPixelRegion` don't have ``as_patch()`` method as
there are no equivalent classes in `matplotlib.patches`.

Here's a full example how to plot a `~regions.CirclePixelRegion` on an image.

Expand Down
6 changes: 3 additions & 3 deletions regions/core/bounding_box.py
Expand Up @@ -188,7 +188,7 @@ def as_patch(self, **kwargs):

Parameters
----------
kwargs
kwargs : `dict`
Any keyword arguments accepted by
`matplotlib.patches.Patch`.

Expand Down Expand Up @@ -246,12 +246,12 @@ def plot(self, origin=(0, 0), ax=None, **kwargs):
ax : `matplotlib.axes.Axes` instance, optional
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whitespace is inconsistent; no before :

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually, sphinx doesn't render properly if there is no before :

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh... my bad, you have to add spaces in other places, not remove them here

If `None`, then the current `~matplotlib.axes.Axes` instance
is used.
kwargs
kwargs : `dict`
Any keyword arguments accepted by `matplotlib.patches.Patch`.

Returns
-------
ax: `~matplotlib.axes`
ax : `~matplotlib.axes.Axes`
Axes on which the patch is added.
"""

Expand Down
6 changes: 3 additions & 3 deletions regions/core/compound.py
Expand Up @@ -133,12 +133,12 @@ def as_patch(self, origin=(0, 0), **kwargs):
"""
Matplotlib patch object for annulus region (`matplotlib.patches.PathPatch`).

Parameters:
-----------
Parameters
----------
origin : array_like, optional
The ``(x, y)`` pixel position of the origin of the displayed image.
Default is (0, 0).
kwargs: dict
kwargs : `dict`
All keywords that a `~matplotlib.patches.PathPatch` object accepts

Returns
Expand Down