autogalaxy.plot.GridPlot#

class GridPlot[source]#

Bases: AbstractMatWrap2D

An abstract base class for wrapping matplotlib plotting methods.

Classes are used to wrap matplotlib so that the data structures in the autoarray.structures package can be plotted in standardized withs. This exploits how these structures have specific formats, units, properties etc. This allows us to make a simple API for plotting structures, for example to plot an Array2D structure:

import autoarray as aa import autoarray.plot as aplt

arr = aa.Array2D.no_mask(values=[[1.0, 1.0], [2.0, 2.0]], pixel_scales=2.0) aplt.Array2D(values=arr)

The wrapped Mat objects make it simple to customize how matplotlib visualizes this data structure, for example we can customize the figure size and colormap using the Figure and Cmap objects.

figure = aplt.Figure(figsize=(7,7), aspect=”square”) cmap = aplt.Cmap(cmap=”jet”, vmin=1.0, vmax=2.0)

plotter = aplt.MatPlot2D(figure=figure, cmap=cmap)

aplt.Array2D(values=arr, plotter=plotter)

The Plotter object is detailed in the autoarray.plot.plotter package.

The matplotlib wrapper objects in ths module also use configuration files to choose their default settings. For example, in autoarray.config.visualize.mat_base.Figure.ini you will note the section:

figure: figsize=(7, 7)

subplot: figsize=auto

This specifies that when a data structure (like the Array2D above) is plotted, the figsize will always be (7,7) when a single figure is plotted and it will be chosen automatically if a subplot is plotted. This allows one to customize the matplotlib settings of every plot in a project.

Methods

plot_grid

Plot an input grid of (y,x) coordinates using the matplotlib method plt.plot.

plot_grid_list

Plot an input list of grids of (y,x) coordinates using the matplotlib method plt.line.

plot_rectangular_grid_lines

Plots a rectangular grid of lines on a plot, using the coordinate system of the figure.

Attributes

config_category

config_dict

config_folder

log10_min_value

plot_rectangular_grid_lines(extent, shape_native)[source]#

Plots a rectangular grid of lines on a plot, using the coordinate system of the figure.

The size and shape of the grid is specified by the extent and shape_native properties of a data structure which will provide the rectangaular grid lines on a suitable coordinate system for the plot.

Parameters:
  • extent ((float, float, float, float)) – The extent of the rectangualr grid, with format [xmin, xmax, ymin, ymax]

  • shape_native (Tuple[int, int]) – The 2D shape of the mask the array is paired with.

plot_grid(grid)[source]#

Plot an input grid of (y,x) coordinates using the matplotlib method plt.plot.

Parameters:

grid (Union[ndarray, Grid2D]) – The grid of (y,x) coordinates that is plotted.

plot_grid_list(grid_list)[source]#

Plot an input list of grids of (y,x) coordinates using the matplotlib method plt.line.

This method colors each grid in the list the same, so that the different grids are visible in the plot.

This provides an alternative to GridScatter.scatter_grid_list where the plotted grids appear as lines instead of scattered points.

Parameters:

grid_list (Union[List[Grid2D], List[Grid2DIrregular]]) – The list of grids of (y,x) coordinates that are plotted.