autolens.plot.MatPlot2D#

class autolens.plot.MatPlot2D(units: Optional[autoarray.plot.wrap.wrap_base.Units] = None, figure: Optional[autoarray.plot.wrap.wrap_base.Figure] = None, axis: Optional[autoarray.plot.wrap.wrap_base.Axis] = None, cmap: Optional[autoarray.plot.wrap.wrap_base.Cmap] = None, colorbar: Optional[autoarray.plot.wrap.wrap_base.Colorbar] = None, colorbar_tickparams: Optional[autoarray.plot.wrap.wrap_base.ColorbarTickParams] = None, tickparams: Optional[autoarray.plot.wrap.wrap_base.TickParams] = None, yticks: Optional[autoarray.plot.wrap.wrap_base.YTicks] = None, xticks: Optional[autoarray.plot.wrap.wrap_base.XTicks] = None, title: Optional[autoarray.plot.wrap.wrap_base.Title] = None, ylabel: Optional[autoarray.plot.wrap.wrap_base.YLabel] = None, xlabel: Optional[autoarray.plot.wrap.wrap_base.XLabel] = None, text: Optional[autoarray.plot.wrap.wrap_base.Text] = None, legend: Optional[autoarray.plot.wrap.wrap_base.Legend] = None, output: Optional[autoarray.plot.wrap.wrap_base.Output] = None, array_overlay: Optional[autoarray.plot.wrap.wrap_2d.ArrayOverlay] = None, grid_scatter: Optional[autoarray.plot.wrap.wrap_2d.GridScatter] = None, grid_plot: Optional[autoarray.plot.wrap.wrap_2d.GridPlot] = None, vector_yx_quiver: Optional[autoarray.plot.wrap.wrap_2d.VectorYXQuiver] = None, patch_overlay: Optional[autoarray.plot.wrap.wrap_2d.PatchOverlay] = None, interpolated_reconstruction: Optional[autoarray.plot.wrap.wrap_2d.InterpolatedReconstruction] = None, voronoi_drawer: Optional[autoarray.plot.wrap.wrap_2d.VoronoiDrawer] = None, origin_scatter: Optional[autoarray.plot.wrap.wrap_2d.OriginScatter] = None, mask_scatter: Optional[autoarray.plot.wrap.wrap_2d.MaskScatter] = None, border_scatter: Optional[autoarray.plot.wrap.wrap_2d.BorderScatter] = None, positions_scatter: Optional[autoarray.plot.wrap.wrap_2d.PositionsScatter] = None, index_scatter: Optional[autoarray.plot.wrap.wrap_2d.IndexScatter] = None, pixelization_grid_scatter: Optional[autoarray.plot.wrap.wrap_2d.PixelizationGridScatter] = None, light_profile_centres_scatter: Optional[autogalaxy.plot.mat_wrap.wrap.LightProfileCentresScatter] = None, mass_profile_centres_scatter: Optional[autogalaxy.plot.mat_wrap.wrap.MassProfileCentresScatter] = None, multiple_images_scatter: Optional[autogalaxy.plot.mat_wrap.wrap.MultipleImagesScatter] = None, critical_curves_plot: Optional[autogalaxy.plot.mat_wrap.wrap.CriticalCurvesPlot] = None, caustics_plot: Optional[autogalaxy.plot.mat_wrap.wrap.CausticsPlot] = None)[source]#
__init__(units: Optional[autoarray.plot.wrap.wrap_base.Units] = None, figure: Optional[autoarray.plot.wrap.wrap_base.Figure] = None, axis: Optional[autoarray.plot.wrap.wrap_base.Axis] = None, cmap: Optional[autoarray.plot.wrap.wrap_base.Cmap] = None, colorbar: Optional[autoarray.plot.wrap.wrap_base.Colorbar] = None, colorbar_tickparams: Optional[autoarray.plot.wrap.wrap_base.ColorbarTickParams] = None, tickparams: Optional[autoarray.plot.wrap.wrap_base.TickParams] = None, yticks: Optional[autoarray.plot.wrap.wrap_base.YTicks] = None, xticks: Optional[autoarray.plot.wrap.wrap_base.XTicks] = None, title: Optional[autoarray.plot.wrap.wrap_base.Title] = None, ylabel: Optional[autoarray.plot.wrap.wrap_base.YLabel] = None, xlabel: Optional[autoarray.plot.wrap.wrap_base.XLabel] = None, text: Optional[autoarray.plot.wrap.wrap_base.Text] = None, legend: Optional[autoarray.plot.wrap.wrap_base.Legend] = None, output: Optional[autoarray.plot.wrap.wrap_base.Output] = None, array_overlay: Optional[autoarray.plot.wrap.wrap_2d.ArrayOverlay] = None, grid_scatter: Optional[autoarray.plot.wrap.wrap_2d.GridScatter] = None, grid_plot: Optional[autoarray.plot.wrap.wrap_2d.GridPlot] = None, vector_yx_quiver: Optional[autoarray.plot.wrap.wrap_2d.VectorYXQuiver] = None, patch_overlay: Optional[autoarray.plot.wrap.wrap_2d.PatchOverlay] = None, interpolated_reconstruction: Optional[autoarray.plot.wrap.wrap_2d.InterpolatedReconstruction] = None, voronoi_drawer: Optional[autoarray.plot.wrap.wrap_2d.VoronoiDrawer] = None, origin_scatter: Optional[autoarray.plot.wrap.wrap_2d.OriginScatter] = None, mask_scatter: Optional[autoarray.plot.wrap.wrap_2d.MaskScatter] = None, border_scatter: Optional[autoarray.plot.wrap.wrap_2d.BorderScatter] = None, positions_scatter: Optional[autoarray.plot.wrap.wrap_2d.PositionsScatter] = None, index_scatter: Optional[autoarray.plot.wrap.wrap_2d.IndexScatter] = None, pixelization_grid_scatter: Optional[autoarray.plot.wrap.wrap_2d.PixelizationGridScatter] = None, light_profile_centres_scatter: Optional[autogalaxy.plot.mat_wrap.wrap.LightProfileCentresScatter] = None, mass_profile_centres_scatter: Optional[autogalaxy.plot.mat_wrap.wrap.MassProfileCentresScatter] = None, multiple_images_scatter: Optional[autogalaxy.plot.mat_wrap.wrap.MultipleImagesScatter] = None, critical_curves_plot: Optional[autogalaxy.plot.mat_wrap.wrap.CriticalCurvesPlot] = None, caustics_plot: Optional[autogalaxy.plot.mat_wrap.wrap.CausticsPlot] = None)[source]#

Visualizes data structures (e.g an Array2D, Grid2D, VectorField, etc.) using Matplotlib.

The Plotter is passed objects from the mat_wrap package which wrap matplotlib plot functions and customize the appearance of the plots of the data structure. If the values of these matplotlib wrapper objects are not manually specified, they assume the default values provided in the config.visualize.mat_* .ini config files.

The following data structures can be plotted using the following matplotlib functions:

  • Array2D:, using plt.imshow.

  • Grid2D: using plt.scatter.

  • Line: using plt.plot, plt.semilogy, plt.loglog or plt.scatter.

  • VectorField: using plt.quiver.

  • RectangularMapper: using plt.imshow.

  • MapperVoronoiNoInterp: using plt.fill.

Parameters
  • units – The units of the figure used to plot the data structure which sets the y and x ticks and labels.

  • figure – Opens the matplotlib figure before plotting via plt.figure and closes it once plotting is complete via plt.close.

  • axis – Sets the extent of the figure axis via plt.axis and allows for a manual axis range.

  • cmap – Customizes the colormap of the plot and its normalization via matplotlib colors objects such as colors.Normalize and colors.LogNorm.

  • colorbar – Plots the colorbar of the plot via plt.colorbar and customizes its tick labels and values using method like cb.set_yticklabels.

  • colorbar_tickparams – Customizes the yticks of the colorbar plotted via plt.colorbar.

  • tickparams – Customizes the appearances of the y and x ticks on the plot, (e.g. the fontsize), using plt.tick_params.

  • yticks – Sets the yticks of the plot, including scaling them to new units depending on the Units object, via plt.yticks.

  • xticks – Sets the xticks of the plot, including scaling them to new units depending on the Units object, via plt.xticks.

  • title – Sets the figure title and customizes its appearance using plt.title.

  • ylabel – Sets the figure ylabel and customizes its appearance using plt.ylabel.

  • xlabel – Sets the figure xlabel and customizes its appearance using plt.xlabel.

  • legend – Sets whether the plot inclues a legend and customizes its appearance and labels using plt.legend.

  • output – Sets if the figure is displayed on the user’s screen or output to .png using plt.show and plt.savefig

  • array_overlay – Overlays an input Array2D over the figure using plt.imshow.

  • grid_scatter – Scatters a Grid2D of (y,x) coordinates over the figure using plt.scatter.

  • grid_plot – Plots lines of data (e.g. a y versus x plot via plt.plot, vertical lines via plt.avxline, etc.)

  • vector_yx_quiver – Plots a VectorField object using the matplotlib function plt.quiver.

  • patch_overlay – Overlays matplotlib patches.Patch objects over the figure, such as an Ellipse.

  • voronoi_drawer – Interpolations the reconstruction of a Mapper object from its irregular grid (e.g. Delaunay, Voronoi) to a uniform 2D array and plots it via plt.imshow().

  • voronoi_drawer – Draws a colored Voronoi mesh of pixels using plt.fill.

  • origin_scatter – Scatters the (y,x) origin of the data structure on the figure.

  • mask_scatter – Scatters an input Mask2d over the plotted data structure’s figure.

  • border_scatter – Scatters the border of an input Mask2d over the plotted data structure’s figure.

  • positions_scatter – Scatters specific (y,x) coordinates input as a Grid2DIrregular object over the figure.

  • index_scatter – Scatters specific coordinates of an input Grid2D based on input values of the Grid2D’s 1D or 2D indexes.

  • pixelization_grid_scatter – Scatters the PixelizationGrid of a Pixelization object.

  • light_profile_centres_scatter – Scatters the (y,x) centres of all LightProfile’s in the plotted object (e.g. a Tracer).

  • mass_profile_centres_scatter – Scatters the (y,x) centres of all MassProfile’s in the plotted object (e.g. a Tracer).

  • light_profile_centres_scatter – Scatters the (y,x) coordinates of the multiple image locations of the lens mass model.

  • critical_curves_plot – Plots the critical curves of the lens mass model as colored lines.

  • caustics_plot – Plots the caustics of the lens mass model as colored lines.

Methods

__init__([units, figure, axis, cmap, …])

Visualizes data structures (e.g an Array2D, Grid2D, VectorField, etc.) using Matplotlib.

get_subplot_rows_columns(number_subplots)

Get the size of a sub plotter in (total_y_pixels, total_x_pixels), based on the number of subplots that are going to be plotted.

plot_array(array, visuals_2d, auto_labels[, …])

Plot an Array2D data structure as a figure using the matplotlib wrapper objects and tools.

plot_grid(grid, visuals_2d, auto_labels[, …])

Plot a grid of (y,x) Cartesian coordinates as a scatter plotter of points.

plot_mapper(mapper, visuals_2d, auto_labels)

set_for_subplot(is_for_subplot)

Sets the is_for_subplot attribute for every MatWrap object in this MatPlot object by updating the is_for_subplot.

setup_subplot([aspect, subplot_rows_columns])