polymerist.graphics.plotutils ============================= .. py:module:: polymerist.graphics.plotutils .. autoapi-nested-parse:: Tools for generating plots and other graphics Attributes ---------- .. autoapisummary:: polymerist.graphics.plotutils.ColorMapper Functions --------- .. autoapisummary:: polymerist.graphics.plotutils.presize_subplots polymerist.graphics.plotutils.plot_df_props polymerist.graphics.plotutils.scatter_3D polymerist.graphics.plotutils.make_cmapper polymerist.graphics.plotutils.plot_image_with_colorbar polymerist.graphics.plotutils.draw_colorbar polymerist.graphics.plotutils.label_discrete_cmap Module Contents --------------- .. py:data:: ColorMapper .. py:function:: presize_subplots(nrows: int, ncols: int, scale: float = 15.0, elongation: float = 1.0) -> tuple[matplotlib.pyplot.Figure, numpy.ndarray[matplotlib.pyplot.Axes]] Prepare a grid of predetermined number of matplotlib subplot axes of a particular size and aspect ratio Returns the resulting Figure and array of individual subplot Axes .. py:function:: plot_df_props(x_dframe: pandas.DataFrame, y_dframe: pandas.DataFrame, df_label: Optional[str] = None, nrows: int = None, ncols: int = None, **plot_kwargs) -> tuple[matplotlib.pyplot.Figure, matplotlib.pyplot.Axes] Takes a DataFrame populated with polymer time series property data and generates sequential plots .. py:function:: scatter_3D(array: numpy.array) -> None Plot an Nx3 array of (x, y, z) coordinate sets in 3-D .. py:function:: make_cmapper(cmap_name: str, vmin: float, vmax: float) -> ColorMapper Wrapper for making normalized color map function .. py:function:: plot_image_with_colorbar(image: PIL.Image.Image, cmap: matplotlib.colors.Colormap, norm: matplotlib.colors.Normalize, label: str = '', ticks: Optional[list[float]] = None, orient: Optional[str] = None, dim: int = 8, aspect: float = 1 / 1) -> tuple[matplotlib.pyplot.Figure, matplotlib.pyplot.Axes] Plots a PIL image with a colorbar and norm of ones choice .. py:function:: draw_colorbar(cmap_name: str, vmin: float, vmax: float, label: str, save_path: pathlib.Path = None) -> matplotlib.colorbar.Colorbar Create a matplotlib colorbar object with appropriate norm, color scale, and labels .. py:function:: label_discrete_cmap(cmap: matplotlib.colors.Colormap, color_names: Iterable[str], hues_per_color: int = 1) -> tuple[dict[str, tuple[int, int, int, int]], numpy.ndarray] Generate named labels for discrete colormaps (e.g. Qualitative colormaps) Accepts the target Colormap, a collection of the unique colors present (in order), and the number of distinct hues per color Returns a dict mapping the named colors, as well as an MxNx4 array of the RGBA colors which can be visualized as an image