graph LR
Matplotlib_Backend_Entry_Points["Matplotlib Backend Entry Points"]
ItermplotFigureManager["ItermplotFigureManager"]
ItermplotFigureCanvasAgg["ItermplotFigureCanvasAgg"]
Matplotlib_Core["Matplotlib Core"]
Image_Processing_Conversion_Module["Image Processing/Conversion Module"]
iTerm2_Communication_Module["iTerm2 Communication Module"]
Matplotlib_Backend_Entry_Points -- "instantiates" --> ItermplotFigureManager
Matplotlib_Backend_Entry_Points -- "instantiates" --> ItermplotFigureCanvasAgg
ItermplotFigureManager -- "retrieves data from" --> ItermplotFigureCanvasAgg
ItermplotFigureManager -- "passes data to" --> Image_Processing_Conversion_Module
Matplotlib_Core -- "draws onto" --> ItermplotFigureCanvasAgg
Matplotlib_Core -- "calls" --> Matplotlib_Backend_Entry_Points
Image_Processing_Conversion_Module -- "hands data to" --> iTerm2_Communication_Module
The itermplot subsystem acts as a custom Matplotlib backend, enabling plots to be displayed directly within the iTerm2 terminal. The process begins with Matplotlib Backend Entry Points which are invoked by Matplotlib Core to create a new figure manager and canvas. The ItermplotFigureManager orchestrates the plot's lifecycle, interacting with ItermplotFigureCanvasAgg to render the plot. Once rendered, the ItermplotFigureManager passes the plot data to the Image Processing/Conversion Module for necessary format adjustments. Finally, the iTerm2 Communication Module takes the processed image data and sends it to iTerm2 using specific escape codes for display. This architecture allows Matplotlib to leverage iTerm2's image display capabilities, providing a seamless plotting experience within the terminal environment.
These functions (new_figure_manager, new_figure_manager_given_figure) are the primary interface for Matplotlib to initiate the creation of a new figure manager and canvas. They adhere to Matplotlib's backend API, setting up the itermplot-specific components required for rendering.
Related Classes/Methods:
This is the core component responsible for managing the Matplotlib figure's lifecycle within the itermplot context. It extends Matplotlib's FigureManagerBase and orchestrates the entire process of drawing, converting, and displaying the plot in iTerm2.
Related Classes/Methods:
This class serves as the itermplot-specific drawing surface, implementing Matplotlib's FigureCanvas using the Agg backend. It's where Matplotlib renders its plots in memory before they are processed for terminal display.
Related Classes/Methods:
Represents the external, core rendering engine of Matplotlib. It interacts with the itermplot backend by requesting new figure managers and drawing plot elements onto the provided canvas.
Related Classes/Methods: None
This module handles the necessary image format conversions (e.g., from Matplotlib's internal representation to PNG) and potentially other image manipulations required before the plot can be sent to iTerm2. This functionality is primarily handled by ItermplotFigureCanvasAgg's print_png method and ItermplotImageMagickWriter.
Related Classes/Methods:
Responsible for the low-level communication with iTerm2, specifically generating and sending the iTerm2 escape codes that embed and display images directly within the terminal. This is primarily handled by the imgcat function.
Related Classes/Methods: