plot_map_rgb#

gammapy.visualization.plot_map_rgb(map_, ax=None, **kwargs)[source]#

Plot RGB image on matplotlib WCS axes.

This function is based on the make_lupton_rgb function. The input map must contain 1 non-spatial axis with exactly 3 bins. If this is not the case, the map has to be resampled before using the plot_map_rgb function (e.g. as shown in the code example below).

Parameters
map_WcsNDMap

WCS map. The map must contain 1 non-spatial axis with exactly 3 bins.

axWCSAxes, optional

WCS axis object to plot on.

**kwargsdict

Keyword arguments passed to make_lupton_rgb.

Returns
axWCSAxes

WCS axis object

Examples

>>> from gammapy.visualization.utils import plot_map_rgb
>>> from gammapy.maps import Map, MapAxis
>>> import astropy.units as u
>>> map_ = Map.read("$GAMMAPY_DATA/cta-1dc-gc/cta-1dc-gc.fits.gz")
>>> axis_rgb = MapAxis.from_energy_edges(
>>>     [0.1, 0.2, 0.5, 10], unit=u.TeV, name="energy", interp="log"
>>> )
>>> map_ = map_.resample_axis(axis_rgb)
>>> kwargs = {"stretch": 0.5, "Q": 1, "minimum": 0.15}
>>> plot_map_rgb(map_.smooth(0.08*u.deg), **kwargs)