Figures and Finished Plots¶
Figures take an Image object(s) or set(s), plot them in some form including colorbars/layout/etc,
and return a matplotlib.figure.Figure object for any further modification or saving.
(You can modify the individual axes by running fig.get_axes())
Some of these figure functions also optionally print statistics to console.
- imtools.figures.collage(library, nimg, greyscale='none', evpa_rainbows=False, rotated=False, show_spin=False, mad_spins=('-0.94', '-0.5', '0.0', '0.5', '0.94'), sane_spins=('-0.94', '-0.5', '0.0', '0.5', '0.94'), rhighs=('1', '10', '20', '40', '80', '160'), figsize=(16, 9), zoom=2, blur=0, vmax=None, average=False, title='', evpa=True, n_evpa=20, evpa_scale='none', compress_scale=False, duplicate=False, verbose=False)¶
A very fiddly function for generating large collages from ``ImageSet``s. Candidate for cleanup if of use externally.
- imtools.figures.compare(image1, image2, relative=True, figsize=(12, 6), print_stats=True)¶
Comparison of all Stokes parameters between images, showing just the image differences.
- Parameters
image{1-2} – Image objects
relative – Use relative difference between each pair of pixels, rather than absolute
figsize – size of returned Figure in inches
print_stats – Print total fluxes and mean squared errors between each Stokes parameter
- imtools.figures.compare_unpol(image1, image2, scale_image=False, same_colorscale=False, print_stats=True, figsize=(20, 5), **kwargs)¶
Comparison of just Stokes I between images, showing both images with their absolute and relative differences.
- Parameters
image{1-2} – Image objects
scale_image – Rescale image1 to have the same total flux as image2
same_colorscale – Enforce that image1 and image2 share the same color scale
print_stats – Print total fluxes and mean squared error between images
figsize – size of returned Figure in inches
kwargs – Extra args are passed to
imtools.plots.plot_var()
- imtools.figures.lightcurves(library, fn, label, mad_spins=('-0.94', '-0.5', '0.0', '0.5', '0.94'), sane_spins=('-0.94', '-0.5', '0.0', '0.5', '0.94'), rhighs=('1', '10', '20', '40', '80', '160'), figsize=(15.5, 10))¶
A very fiddly function for generating large comparisons between lightcurves from ``ImageSet``s. Candidate for cleanup if of use externally.
- imtools.figures.plot_pol(image, figsize=(8, 8), print_stats=True, evpa_ticks=True)¶
Mimics the plot_pol.py script in ipole/scripts
- Parameters
image – Image object
figsize – size of returned Figure in inches
print_stats – Print total flux and integrated polarization stats
evpa_ticks – Overlay EVPA as a quiver plot
- imtools.figures.plot_stokes_rows(images, figsize=(12, 12), units='Jy', n_stokes=4, vmax=None, consistent_scale=True, key_image=0, **kwargs)¶
Plot a series of horizontal 4-pane Stokes images, arranged vertically without spacing to compare each parameter down columns. Places all colorbars along the very bottom of the figure.
- Parameters
image – list of Image objects (each should have a ‘name’ attribute for correct labeling!)
figsize – size of returned Figure in inches
units – “cgs” for intensity, “Jy” for Jy/px flux
n_stokes – number of Stokes parameters to plot. Normally 4 but e.g. 3 when V is trivial/undesired
vmax – list of maximum flux values, to be used as vmax for stokes I, vmax/vmin for Stokes Q, U, V
consistent_scale – Keep the scale consistent between images if setting vmax automatically
key_images – Index of the image to use when setting ‘consistent_scale’
kwargs – Passed to
imtools.plots.plot_all_stokes()
- imtools.figures.plot_stokes_square(image, figsize=(8, 10), **kwargs)¶
Plot a 4-pane image showing each Stokes parameter. Defaults to large
- imtools.figures.plot_unpol(image, figsize=(8, 8), print_stats=True, **kwargs)¶
Mimics the plot.py script in ipole/scripts.
- Parameters
image – Image object
figsize – size of returned Figure in inches
print_stats – Print total flux
evpa_ticks – Overlay EVPA as a quiver plot