Fix plot examples regionnd docs
@@ -219,24 +219,22 @@ Plotting a RegionGeom
It can be useful to plot the region that defines a `~RegionGeom`, on its own or on top
of an existing `~Map`. This is done via `~RegionGeom.plot_region()`:
-.. code-block:: python
-
- from gammapy.maps import RegionGeom
- geom = RegionGeom.create("icrs;circle(83.63, 22.01, 0.5)")
- geom.plot_region()
.. plot::
+ :include-source:
from gammapy.maps import RegionGeom
geom = RegionGeom.create("icrs;circle(83.63, 22.01, 0.5)")
geom.plot_region()
+
One can also plot the region on top of an existing map, and change the properties of the
different regions by passing keyword arguments forwarded to `~regions.PixelRegion.as_artist`.
.. plot::
:include-source:
+
from gammapy.maps import RegionGeom, Map
import numpy as np
@@ -267,6 +265,7 @@ different regions by passing keyword arguments forwarded to `~regions.PixelRegio
# Filling the region with a color
annulus.plot_region(lw=2, ec='purple', fc='purple')
+
RegionNDMap
===========
A `~RegionNDMap` owns a `~RegionGeom` instance as well as a data array containing the values associated
@@ -359,7 +358,8 @@ Plotting the underlying region
This is equivalent to the `~RegionGeom.plot_region()` described above, and, in fact, the `~RegionNDMap` method simply calls it on the associated
region geometry, `~RegionNDMap.geom`. Consequently, the use of this method is already described by the section above.
-.. code-block:: python
+.. plot::
+ :include-source:
from gammapy.maps import RegionNDMap
region_map = RegionNDMap.create("icrs;circle(83.63, 22.01, 0.5)")
@@ -371,7 +371,6 @@ Plotting the map content
This is only possible if the region map has a non-spatial axis.
.. plot::
-
:include-source:
from gammapy.maps import MapAxis, RegionNDMap
