molgri.plotting.spheregrid_plots

Plotting SphereGridNDim and Polytope-based objects.

Visualising 3D with 3D and hammer plots and 4D with translation animation and cell plots. Plotting spherical Voronoi cells and their areas. A lot of convergence and uniformity testing.

Classes

ConvergenceSphereGridPlot(convergence_sph_grid)

In the __init__, defaults should be set that will generally be used for an entire class of figures - but it is still possible to not use defaults for some of the plots.

PanelConvergenceSphereGridPlots([dim, N_set])

PanelSphereGridPlots(N_points, grid_dim[, ...])

PolytopePlot(polytope, **kwargs)

In the __init__, defaults should be set that will generally be used for an entire class of figures - but it is still possible to not use defaults for some of the plots.

SphereGridPlot(sphere_grid, **kwargs)

In the __init__, defaults should be set that will generally be used for an entire class of figures - but it is still possible to not use defaults for some of the plots.

class molgri.plotting.spheregrid_plots.SphereGridPlot(sphere_grid: SphereGridNDim, **kwargs)

In the __init__, defaults should be set that will generally be used for an entire class of figures - but it is still possible to not use defaults for some of the plots.

Args:

data_name: keyword that combines all figures of a specific sub-class fig_path: folder to save figures if created, should be set in subclasses ani_path: folder to save animations if created, should be set in subclasses default_context: forwarded to sns.set_context -> should be one of: paper, notebook, talk, poster default_color_style: describes the general color scheme of the plots (dark, white) default_complexity_level: select from full, half_empty, empty

__init__(sphere_grid: SphereGridNDim, **kwargs)

In the __init__, defaults should be set that will generally be used for an entire class of figures - but it is still possible to not use defaults for some of the plots.

Args:

data_name: keyword that combines all figures of a specific sub-class fig_path: folder to save figures if created, should be set in subclasses ani_path: folder to save animations if created, should be set in subclasses default_context: forwarded to sns.set_context -> should be one of: paper, notebook, talk, poster default_color_style: describes the general color scheme of the plots (dark, white) default_complexity_level: select from full, half_empty, empty

get_possible_title()
make_grid_plot(fig: Figure | None = None, ax: Axes3D | None = None, save: bool = True)

Plot the 3D grid plot, for 4D the 4th dimension plotted as color. It always has limits (-1, 1) and equalized figure size

make_grid_colored_with_alpha(ax=None, fig=None, central_vector: ndarray[Any, dtype[ScalarType]] | None = None, save=True)
make_uniformity_plot(ax: Axes | None = None, fig: Figure | None = None, save=True)

Creates violin plots that are a measure of grid uniformity. A good grid will display minimal variation along a range of angles alpha.

make_convergence_plot(ax: Axes | None = None, fig: Figure | None = None, save=True)

Creates convergence plots that show how coverages approach optimal values.

make_spherical_voronoi_plot(ax=None, fig=None, save=True, animate_rot=False)
make_rot_animation()
make_ordering_animation()
make_trans_animation(fig: Figure | None = None, ax=None)
create_all_plots(and_animations=False)
class molgri.plotting.spheregrid_plots.PolytopePlot(polytope: Polytope, **kwargs)

In the __init__, defaults should be set that will generally be used for an entire class of figures - but it is still possible to not use defaults for some of the plots.

Args:

data_name: keyword that combines all figures of a specific sub-class fig_path: folder to save figures if created, should be set in subclasses ani_path: folder to save animations if created, should be set in subclasses default_context: forwarded to sns.set_context -> should be one of: paper, notebook, talk, poster default_color_style: describes the general color scheme of the plots (dark, white) default_complexity_level: select from full, half_empty, empty

__init__(polytope: Polytope, **kwargs)

In the __init__, defaults should be set that will generally be used for an entire class of figures - but it is still possible to not use defaults for some of the plots.

Args:

data_name: keyword that combines all figures of a specific sub-class fig_path: folder to save figures if created, should be set in subclasses ani_path: folder to save animations if created, should be set in subclasses default_context: forwarded to sns.set_context -> should be one of: paper, notebook, talk, poster default_color_style: describes the general color scheme of the plots (dark, white) default_complexity_level: select from full, half_empty, empty

make_graph(ax=None, fig=None, with_labels=True, save=True)

Plot the networkx graph of self.G.

make_neighbours_plot(ax: Axes3D | None = None, fig: Figure | None = None, save: bool = True, node_i: int = 0)

Want to see which points count as neighbours, second- or third neighbours of a specific node? Use this plotting method.

make_node_plot(ax: Axes3D | None = None, fig: Figure | None = None, select_faces: set | None = None, projection: bool = False, plot_edges: bool = False, color_by: str = 'level', save=True)

Plot the points of the polytope + possible division points. Colored by level at which the point was added. Or: colored by index to see how sorting works. Possible to select only one or a few faces on which points are to be plotted for clarity.

Args:

fig: figure ax: axis save: whether to save fig select_faces: a set of face numbers that can range from 0 to number of faces of the polyhedron, e.g. {0, 5}.

If None, all faces are shown.

projection: True if you want to plot the projected points, not the ones on surfaces of polytope plot_edges: select True if you want to see connections between nodes color_by: “level” or “index”

make_cell_plot(ax: Axes3D | None = None, fig: Figure | None = None, cell_index: int = 0, draw_edges: bool = True, save: bool = True, animate_rot: bool = False)

Since you cannot visualise a 4D object directly, here’s an option to visualise the 3D sub-cells of a 4D object.

Args:

fig: figure ax: axis save: whether to save fig cell_index: index of the sub-cell to plot (in cube4D that can be 0-7) draw_edges: use True if you want to also draw edges, False if only points

create_all_plots()
class molgri.plotting.spheregrid_plots.PanelSphereGridPlots(N_points: int, grid_dim: int, default_context: str | None = None, default_complexity_level: str | None = None, default_color_style: str | None = None, use_saved=False, **kwargs)
__init__(N_points: int, grid_dim: int, default_context: str | None = None, default_complexity_level: str | None = None, default_color_style: str | None = None, use_saved=False, **kwargs)
make_all_grid_plots(animate_rot=False)
make_all_convergence_plots()
make_all_uniformity_plots()
create_all_plots(and_animations=False)
class molgri.plotting.spheregrid_plots.ConvergenceSphereGridPlot(convergence_sph_grid: ConvergenceSphereGridFactory)

In the __init__, defaults should be set that will generally be used for an entire class of figures - but it is still possible to not use defaults for some of the plots.

Args:

data_name: keyword that combines all figures of a specific sub-class fig_path: folder to save figures if created, should be set in subclasses ani_path: folder to save animations if created, should be set in subclasses default_context: forwarded to sns.set_context -> should be one of: paper, notebook, talk, poster default_color_style: describes the general color scheme of the plots (dark, white) default_complexity_level: select from full, half_empty, empty

__init__(convergence_sph_grid: ConvergenceSphereGridFactory)

In the __init__, defaults should be set that will generally be used for an entire class of figures - but it is still possible to not use defaults for some of the plots.

Args:

data_name: keyword that combines all figures of a specific sub-class fig_path: folder to save figures if created, should be set in subclasses ani_path: folder to save animations if created, should be set in subclasses default_context: forwarded to sns.set_context -> should be one of: paper, notebook, talk, poster default_color_style: describes the general color scheme of the plots (dark, white) default_complexity_level: select from full, half_empty, empty

get_possible_title()
make_voronoi_area_conv_plot(ax=None, fig=None, save=True)
make_spheregrid_time_plot(ax=None, fig=None, save=True)
class molgri.plotting.spheregrid_plots.PanelConvergenceSphereGridPlots(dim=3, N_set: list | None = None, **kwargs)
__init__(dim=3, N_set: list | None = None, **kwargs)
make_all_voronoi_area_plots(save=True)
make_all_spheregrid_time_plots(save=True)