prolint.plotting.base ===================== .. py:module:: prolint.plotting.base .. autoapi-nested-parse:: Plotting base module. This module provides the base classes and registry for ProLint plotters. Classes ------- .. autoapisummary:: prolint.plotting.base.BasePlotter prolint.plotting.base.PlottingRegistry Functions --------- .. autoapisummary:: prolint.plotting.base.plot Module Contents --------------- .. py:class:: BasePlotter Bases: :py:obj:`abc.ABC` Abstract base class for all ProLint plotters. Plotters convert AnalysisResult objects into matplotlib visualizations. Subclasses must implement the ``plot()`` method. .. attribute:: name Plotter name for registry lookup. :type: str .. attribute:: required_analysis Name of the analysis type this plotter expects. :type: str .. attribute:: description Human-readable description. :type: str .. seealso:: :py:obj:`PlottingRegistry` Registry for creating plotters by name :py:obj:`plot` Convenience function for plotting .. py:attribute:: name :type: str :value: 'base_plotter' .. py:attribute:: required_analysis :type: str :value: '' .. py:attribute:: description :type: str :value: 'Base plotter class' .. py:method:: validate_result(result: prolint.analysis.base.AnalysisResult) -> None :classmethod: Validate that the AnalysisResult contains required data keys. :param result: Result to validate. :type result: AnalysisResult :raises ValueError: If result is missing required keys for this plotter. .. py:method:: plot(result: prolint.analysis.base.AnalysisResult, **kwargs) -> Tuple[matplotlib.figure.Figure, matplotlib.axes.Axes] :classmethod: :abstractmethod: Create the plot from an AnalysisResult. :param result: Analysis result containing data to plot. :type result: AnalysisResult :param \*\*kwargs: Plotter-specific options. :type \*\*kwargs: dict :returns: Matplotlib figure and axes objects. :rtype: tuple of (Figure, Axes) .. py:class:: PlottingRegistry Registry for plotter types. Manages registration and creation of plotter classes. All built-in plotters are registered automatically on import. .. rubric:: Examples List available plotters: >>> from prolint.plotting import PlottingRegistry >>> PlottingRegistry.available() ['heatmap', 'density_map', 'survival_curve', ...] Create a plot: >>> fig, ax = PlottingRegistry.plot("heatmap", result) .. py:method:: register(name: str, plotter_class: Type[BasePlotter]) -> None :classmethod: Register a plotter class. :param name: Name to register under. :type name: str :param plotter_class: Plotter class (must inherit from BasePlotter). :type plotter_class: type .. py:method:: plot(name: str, result: prolint.analysis.base.AnalysisResult, **kwargs) -> Tuple[matplotlib.figure.Figure, matplotlib.axes.Axes] :classmethod: Create a plot using a registered plotter. :param name: Plotter type name. :type name: str :param result: Analysis result to plot. :type result: AnalysisResult :param \*\*kwargs: Plotter-specific options. :type \*\*kwargs: dict :returns: Matplotlib figure and axes objects. :rtype: tuple of (Figure, Axes) :raises ValueError: If plotter name is not registered. .. py:method:: available() -> List[str] :classmethod: List all available plot types. :returns: Registered plotter names. :rtype: list of str .. py:method:: get_class(name: str) -> Type[BasePlotter] :classmethod: Get a plotter class by name. :param name: Plotter name. :type name: str :returns: Plotter class. :rtype: type .. py:method:: get_info(name: str) -> Dict[str, str] :classmethod: Get information about a plotter. :param name: Plotter name. :type name: str :returns: Dict with name, required_analysis, and description keys. :rtype: dict .. py:method:: list_plotters() -> List[Dict[str, str]] :classmethod: List all plotters with their info. :returns: Info dict for each registered plotter. :rtype: list of dict .. py:function:: plot(name: str, result: prolint.analysis.base.AnalysisResult, **kwargs) -> Tuple[matplotlib.figure.Figure, matplotlib.axes.Axes] Create a plot from an AnalysisResult. Convenience function that delegates to PlottingRegistry.plot(). :param name: Plotter type name. :type name: str :param result: Analysis result to plot. :type result: AnalysisResult :param \*\*kwargs: Plotter-specific options. :type \*\*kwargs: dict :returns: Matplotlib figure and axes objects. :rtype: tuple of (Figure, Axes) .. rubric:: Examples >>> from prolint.plotting import plot >>> fig, ax = plot("heatmap", timeseries_result) >>> fig, ax = plot("survival_curve", kinetics_result)