plot_rgb¶
- mpdaf.obj.plot_rgb(images, title=None, scale='linear', vmin=None, vmax=None, zscale=False, show_xlabel=False, show_ylabel=False, ax=None, unit=Unit('deg'), use_wcs=False, **kwargs)[source]¶
Plot the RGB composite image with axes labeled in pixels.
For each color, final intensity values are assigned to each pixel as follows. First each pixel value,
pv
, is normalized over the rangevmin
tovmax
, to have a valuenv
, that goes from 0 to 1, as follows:nv = (pv - vmin) / (vmax - vmin)
This value is then mapped to another number between 0 and 1 which determines the final value to give the displayed pixel. The mapping from normalized values to final value can be chosen using the scale argument, from the following options:
‘linear’:
color = nv
‘log’:
color = log(1000 * nv + 1) / log(1000 + 1)
‘sqrt’:
color = sqrt(nv)
‘arcsinh’:
color = arcsinh(10*nv) / arcsinh(10.0)
By default the image is displayed in its own plot. Alternatively to make it a subplot of a larger figure, a suitable
matplotlib.axes.Axes
object can be passed via theax
argument. Note that unless matplotlib interative mode has previously been enabled by callingmatplotlib.pyplot.ion()
, the plot window will not appear until the next time thatmatplotlib.pyplot.show()
is called. So to arrange that a new window appears as soon asplot_rgb
is called, do the following before the first call toplot_rgb
:import matplotlib.pyplot as plt plt.ion()
- Parameters:
- images[
Image
,Image
,Image
] The three [blue, green, red] images to be used. i.e. ordered by increasing wavelength.
- title
str
An optional title for the figure (None by default).
- scale‘linear’ | ‘log’ | ‘sqrt’ | ‘arcsinh’
The stretch function to use mapping pixel values to final values (The default is ‘linear’). The same scaling is applied to all three imasges. The pixel values are first normalized to range from 0 for values <= vmin, to 1 for values >= vmax, then the stretch algorithm maps these normalized values, nv, to a position p from 0 to 1 along the colorbar, as follows: linear: p = nv log: p = log(1000 * nv + 1) / log(1000 + 1) sqrt: p = sqrt(nv) arcsinh: p = arcsinh(10*nv) / arcsinh(10.0)
- vmin[
float
,float
,float
] Lower limits corresponding to the [blue, green, red] images. Pixels that have values <= vmin are assigned a value of 0. Pixel values between vmin and vmax are scaled according to the mapping algorithm specified by the scale argument.
- vmax[
float
,float
,float
] Upper limits corresponding to the [blue, green, red] images. Pixels that have values >= vmax are assigned a value of 1. Pixel values between vmin and vmax are scaled according to the mapping algorithm specified by the scale argument.
- zscalebool
If True, vmin and vmax are automatically computed using the IRAF zscale algorithm.
- ax
matplotlib.axes.Axes
An optional Axes instance in which to draw the image, or None to have one created using
matplotlib.pyplot.gca()
.- unit
astropy.units.Unit
The units to use for displaying world coordinates (degrees by default). In the interactive plot, when the mouse pointer is over a pixel in the image the coordinates of the pixel are shown using these units, along with the pixel value.
- use_wcsbool
If True, use
astropy.visualization.wcsaxes
to get axes with world coordinates.- kwargs
matplotlib.artist.Artist
Optional extra keyword/value arguments to be passed to the
ax.imshow()
function.
- images[
- Returns:
- ax
matplotlib
AxesImage
- images_aligned
Image
,Image
,Image
The input images, but all aligned to that with the highest resolution.
- ax