Skip to content

core

Generic matplotlib plot class.

MatplotlibPlot

Bases: pathpyG.visualisations.plot.PathPyPlot

Base class for plotting matplotlib objects.

Source code in src/pathpyG/visualisations/_matplotlib/core.py
class MatplotlibPlot(PathPyPlot):
    """Base class for plotting matplotlib objects."""

    def generate(self) -> None:
        """Generate the plot."""
        raise NotImplementedError

    def save(self, filename: str, **kwargs: Any) -> None:  # type: ignore
        """Save the plot to the hard drive."""
        self.to_fig().savefig(filename)

    def show(self, **kwargs: Any) -> None:  # type: ignore
        """Show the plot on the device."""
        self.to_fig().show()

    def to_fig(self) -> Any:  # type: ignore
        """Convert to matplotlib figure."""
        raise NotImplementedError

generate

Generate the plot.

Source code in src/pathpyG/visualisations/_matplotlib/core.py
def generate(self) -> None:
    """Generate the plot."""
    raise NotImplementedError

save

Save the plot to the hard drive.

Source code in src/pathpyG/visualisations/_matplotlib/core.py
def save(self, filename: str, **kwargs: Any) -> None:  # type: ignore
    """Save the plot to the hard drive."""
    self.to_fig().savefig(filename)

show

Show the plot on the device.

Source code in src/pathpyG/visualisations/_matplotlib/core.py
def show(self, **kwargs: Any) -> None:  # type: ignore
    """Show the plot on the device."""
    self.to_fig().show()

to_fig

Convert to matplotlib figure.

Source code in src/pathpyG/visualisations/_matplotlib/core.py
def to_fig(self) -> Any:  # type: ignore
    """Convert to matplotlib figure."""
    raise NotImplementedError