GraphicsGrid

A class for easily building sophisticated multi-panel figures. Robustification work still needs to be done, but the core interface is there. Supports themes & direct, easy access to the panels, among other things. Builds off of GraphicsBase.

Properties and Methods

default_style: dict

 

__init__(self, *args, nrows=2, ncols=2, graphics_class=<class 'McUtils.Plots.Graphics.Graphics'>, figure=None, axes=None, subplot_kw=None, _subplot_init=None, mpl_backend=None, subimage_size=(200, 200), padding=None, spacings=None, **opts): 

 

set_options(self, padding=None, spacings=None, background=None, colorbar=None, figure_label=None, **parent_opts): 

 

__iter__(self): 

 

__getitem__(self, item): 

 

__setitem__(self, item, val): 

 

__getattr__(self, item): 

 

calc_image_size(self): 

 

@property
image_size(self): 

 

@property
figure_label(self): 

 

@property
padding(self): 

 

@property
padding_left(self): 

 

@property
padding_right(self): 

 

@property
padding_top(self): 

 

@property
padding_bottom(self): 

 

@property
spacings(self): 

 

@property
background(self): 

 

@property
colorbar(self): 

 

prep_show(self): 

 

show(self, **kwargs): 

Examples

Create a multi-panel figure

grid = np.linspace(0, 2 * np.pi, 100)
grid_2D = np.meshgrid(grid, grid)
x = grid_2D[1]
y = grid_2D[0]

main = GraphicsGrid(ncols=3, nrows=1, theme='Solarize_Light2', figure_label='my beuatufil triptych',
                            padding=((35, 60), (35, 40)), subimage_size=300)
main[0, 0] = ContourPlot(x, y, np.sin(y), plot_label='$sin(x)$',
                         axes_labels=[None, "cats (cc)"],
                         figure=main[0, 0]
                         )
main[0, 1] = ContourPlot(x, y, np.sin(x) * np.cos(y),
                         plot_label='$sin(x)cos(y)$',
                         axes_labels=[Styled("dogs (arb.)", {'color': 'red'}), None],
                         figure=main[0, 1])
main[0, 2] = ContourPlot(x, y, np.cos(y), plot_label='$cos(y)$', figure=main[0, 2])
main.colorbar = {"graphics": main[0, 1].graphics}

plot


Edit Examples or Create New Examples
Edit Template or Create New Template
Edit Docstrings