modules.plotters
Pipeline modules for data visualization using plotly.
This module contains lightweight PipeModule wrappers that delegate to the core visualization classes in dataViewers/. This separation allows for code compilation while maintaining clean pipeline integration.
Classes
- class modules.plotters.LineChartPlotter
Pipeline module for creating line charts using LineViewer.
This module creates a line chart from a table of data.
- Inherits from:
PipeModule
Methods:
- __init__(mname: str = 'LineChartPlotter', auto_run: bool = True, x_column: str | None = None, y_columns: str | list[str] | None = None, color_column: str | None = None, output_dir: str | Path | None = None, output_name: str = 'line_chart', chart_title: str | None = None, show_markers: bool = True, show_lines: bool = True, line_width: float | None = None, line_style: str = 'solid', marker_size: float | None = None, x_label: str | None = None, y_label: str | None = None, show_legend: bool = True, show_grid: bool = True, title_font_size: float = 20, axis_label_font_size: float = 16, axis_tick_font_size: float = 14, legend_font_size: float = 14, hover_font_size: float = 14, y_range: tuple[float, float] | list[float] | None = None, x_range: tuple[float, float] | list[float] | None = None, xaxis_tickformat: str | None = None, theme: str = 'plotly_white', output_formats: str | list[str] | None = None, generate_files: bool = True, generate_plot_data: bool = True)
Initialize LineChartModule.
Examples
Dict keys can be field_name or field_title from TableData - line_widths : list or dict, per-line widths - marker_sizes : list or dict, per-line marker sizes - marker_symbols : list or dict, per-line marker symbols Options: "circle", "square", "diamond", "cross", "x", "triangle-up", etc. - line_color : str, line color for all traces - marker_color : str, marker color for all traces - opacity : float, trace opacity (0-1) **Layout-level options** (applied to figure layout): Axis configuration: - xaxis_type : str, axis type ("linear", "log", "date", "category") - yaxis_type : str, axis type ("linear", "log", "date", "category") - xaxis_tickangle : float, rotation angle for x-axis tick labels Legend configuration: - legend_title : str, legend title text - legend_orientation : str, legend orientation ("v" or "h") - legend_x : float, legend x position (0-1) - legend_y : float, legend y position (0-1) - legend_xanchor : str, x anchor ("left", "center", "right") - legend_yanchor : str, y anchor ("top", "middle", "bottom") Advanced layout: - plot_bgcolor : str, plot background color - paper_bgcolor : str, paper background color - hovermode : str, hover interaction mode - And any other Plotly layout options For complete options, see Plotly documentation: - Figure layout: https://plotly.com/python/reference/layout/ - Scatter traces: https://plotly.com/python/reference/scatter/ Ports InputData: TableData or GeneralTable to visualize as line chart OutputImageFile: Path to generated image file (PNG/JPEG) OutputHtmlFile: Path to generated interactive HTML file OutputPlotData: JSON data for web frontend visualization
Attributes:
- InputData: PortReference[PortTypeHint.TableData | PortTypeHint.GeneralTable]
- OutputImageFile: PortReference[PortTypeHint.FilePath]
- OutputHtmlFile: PortReference[PortTypeHint.FilePath]
- OutputPlotData: PortReference[PortTypeHint.PlotData]
- class modules.plotters.BarChartPlotter
Pipeline module for creating bar charts using BarViewer.
This module creates a bar chart from a table of data.
- Inherits from:
PipeModule
Methods:
- __init__(mname: str = 'BarChartPlotter', auto_run: bool = True, x_column: str | None = None, y_columns: str | list[str] | None = None, color_column: str | None = None, orientation: str = 'vertical', output_dir: str | Path | None = None, output_name: str = 'bar_chart', chart_title: str | None = None, x_label: str | None = None, y_label: str | None = None, show_legend: bool = True, show_grid: bool = True, title_font_size: float = 20, axis_label_font_size: float = 16, axis_tick_font_size: float = 14, legend_font_size: float = 14, hover_font_size: float = 14, y_range: tuple[float, float] | list[float] | None = None, x_range: tuple[float, float] | list[float] | None = None, xaxis_tickformat: str | None = None, theme: str = 'plotly_white', output_formats: str | list[str] | None = None, generate_files: bool = True, generate_plot_data: bool = True)
Initialize BarChartPlotter.
Attributes:
- InputData: PortReference[PortTypeHint.TableData | PortTypeHint.GeneralTable]
- OutputImageFile: PortReference[PortTypeHint.FilePath]
- OutputHtmlFile: PortReference[PortTypeHint.FilePath]
- OutputPlotData: PortReference[PortTypeHint.PlotData]
- class modules.plotters.ScatterChartPlotter
Pipeline module for creating scatter plots using ScatterViewer.
This module creates a scatter plot from a table of data.
- Inherits from:
PipeModule
Methods:
- __init__(mname: str = 'ScatterChartPlotter', auto_run: bool = True, x_column: str | None = None, y_columns: str | list[str] | None = None, color_column: str | None = None, size_column: str | None = None, show_trendline: bool = False, output_dir: str | Path | None = None, output_name: str = 'scatter_plot', chart_title: str | None = None, marker_size: float | None = None, marker_symbol: str = 'circle', x_label: str | None = None, y_label: str | None = None, show_legend: bool = True, show_grid: bool = True, title_font_size: float = 20, axis_label_font_size: float = 16, axis_tick_font_size: float = 14, legend_font_size: float = 14, hover_font_size: float = 14, y_range: tuple[float, float] | list[float] | None = None, x_range: tuple[float, float] | list[float] | None = None, xaxis_tickformat: str | None = None, theme: str = 'plotly_white', output_formats: str | list[str] | None = None, generate_files: bool = True, generate_plot_data: bool = True)
Initialize ScatterChartPlotter.
Attributes:
- InputData: PortReference[PortTypeHint.TableData | PortTypeHint.GeneralTable]
- OutputImageFile: PortReference[PortTypeHint.FilePath]
- OutputHtmlFile: PortReference[PortTypeHint.FilePath]
- OutputPlotData: PortReference[PortTypeHint.PlotData]
- class modules.plotters.HistogramPlotter
Pipeline module for creating histograms using HistogramViewer.
This module creates a histogram from a table of data.
- Inherits from:
PipeModule
Methods:
- __init__(mname: str = 'HistogramPlotter', auto_run: bool = True, column: str | None = None, color_column: str | None = None, bins: int | None = None, show_rug: bool = False, output_dir: str | Path | None = None, output_name: str = 'histogram', chart_title: str | None = None, bar_mode: str = 'overlay', opacity: float = 0.7, x_label: str | None = None, y_label: str | None = None, show_legend: bool = True, show_grid: bool = True, title_font_size: float = 20, axis_label_font_size: float = 16, axis_tick_font_size: float = 14, legend_font_size: float = 14, hover_font_size: float = 14, y_range: tuple[float, float] | list[float] | None = None, x_range: tuple[float, float] | list[float] | None = None, theme: str = 'plotly_white', output_formats: str | list[str] | None = None, generate_files: bool = True, generate_plot_data: bool = True)
Initialize HistogramPlotter.
Attributes:
- InputData: PortReference[PortTypeHint.TableData | PortTypeHint.GeneralTable]
- OutputImageFile: PortReference[PortTypeHint.FilePath]
- OutputHtmlFile: PortReference[PortTypeHint.FilePath]
- OutputPlotData: PortReference[PortTypeHint.PlotData]
- class modules.plotters.PieChartPlotter
Pipeline module for creating pie charts using PieViewer.
This module creates a pie chart from a table of data.
- Inherits from:
PipeModule
Methods:
- __init__(mname: str = 'PieChartPlotter', auto_run: bool = True, labels_column: str | None = None, values_column: str | None = None, output_dir: str | Path | None = None, output_name: str = 'pie_chart', chart_title: str | None = None, hole_size: float = 0.0, text_info: str = 'label+percent', text_position: str = 'outside', show_legend: bool = True, title_font_size: float = 20, legend_font_size: float = 14, hover_font_size: float = 14, text_font_size: float = 12, theme: str = 'plotly_white', output_formats: str | list[str] | None = None, generate_files: bool = True, generate_plot_data: bool = True)
Initialize PieChartPlotter.
Attributes:
- InputData: PortReference[PortTypeHint.TableData | PortTypeHint.GeneralTable]
- OutputImageFile: PortReference[PortTypeHint.FilePath]
- OutputHtmlFile: PortReference[PortTypeHint.FilePath]
- OutputPlotData: PortReference[PortTypeHint.PlotData]
- class modules.plotters.TablePlotter
Pipeline module for creating formatted tables using TableViewer.
- Inherits from:
PipeModule
Methods:
- __init__(mname: str = 'TablePlotter', auto_run: bool = True, show_main_table: bool = True, show_sub_tables: bool = True, merge_related_cells: bool = True, max_rows: int | None = None, columns: list[str] | None = None, numeric_precision: int | dict[str, int] = 3, output_dir: str | Path | None = None, output_name: str = 'table', table_title: str | None = None, theme: str = 'plotly_white', generate_file: bool = True, generate_plot_data: bool = True, show_title: bool = True, header_font_size: int = 14, content_font_size: int = 12, header_height: int = 40, content_height: int = 30, header_latex_support: bool = True, content_latex_support: bool = True, header_color: str | None = None, width_type: Literal[relative, absolute] = 'relative', column_width_mode: Literal[auto, equal, specified] = 'auto', column_widths: list[int | float] | None = None, table_width_estimate: int = 1200, min_column_width: int = 60, max_column_width: int | None = None, enable_text_wrapping: bool = True, wrap_threshold_factor: float = 0.9, chars_per_pixel: float = 0.1, min_wrap_length: int = 5, enable_zebra_stripes: bool = True, zebra_even_color: str | None = None, zebra_odd_color: str | None = None, column_padding: int = 24, content_length_percentile: float = 0.9, max_content_width_ratio: float = 0.45)
Initialize TablePlotter with layout defaults optimized for Chinese tables.
Examples
Content longer than this limit will wrap within the column. Ports InputData: TableData, TableCollection, or DataFrame to visualize as formatted table OutputHtmlFile: Path to generated HTML table file OutputPlotData: JSON data for web frontend visualization
Attributes:
- InputData: PortReference[PortTypeHint.TableData | PortTypeHint.TableCollection | PortTypeHint.GeneralTable]
- OutputHtmlFile: PortReference[PortTypeHint.FilePath]
- OutputPlotData: PortReference[PortTypeHint.PlotData]
- class modules.plotters.PlotMerger
Merge multiple PlotData outputs into a single composite chart.
This module takes plot data from multiple chart plotters (LineChartPlotter, ScatterChartPlotter, BarChartPlotter, etc.) and combines them into a single canvas. This allows building complex visualizations by composing simple charts.
The module uses dynamic input ports, similar to MergeDocData, allowing you to connect any number of PlotData sources.
Examples
.. code-block:: python # Create individual plotters line_plotter = LineChartPlotter( y_columns=["temperature"], generate_files=False, # Only need plot data ) scatter_plotter = ScatterChartPlotter( y_column="humidity", generate_files=False, ) # Create merger with dynamic ports merger = PlotMerger( chart_title="Temperature & Humidity Analysis", enable_secondary_y=True, ) merger.add_dynamic_ports_in("InputPlotData1") merger.add_dynamic_ports_in("InputPlotData2") # Connect in pipeline pipeline.add_links([ loader.OutputData >> line_plotter.InputData, loader.OutputData >> scatter_plotter.InputData, line_plotter.OutputPlotData >> merger.InputPlotData1, scatter_plotter.OutputPlotData >> merger.InputPlotData2, ]) # Secondary y-axis configuration merger.secondary_y_sources = ["InputPlotData2"] # Second source on right axis Ports Dynamic Input Ports (add via add_dynamic_ports_in): InputPlotData1, InputPlotData2, etc. : PlotData from chart plotters OutputImageFile : Path to generated image file (PNG/JPEG) OutputHtmlFile : Path to generated interactive HTML file OutputPlotData : Merged JSON data for web frontend visualization- Inherits from:
PipeModule
Methods:
- __init__(mname: str = 'PlotMerger', auto_run: bool = True, all_ports_required: bool = True, chart_title: str | None = None, enable_secondary_y: bool = False, secondary_y_sources: list[str | int] | None = None, y_label: str | None = None, y2_label: str | None = None, x_label: str | None = None, show_legend: bool = True, legend_position: Literal[auto, top, bottom, left, right] = 'auto', title_font_size: float = 20, axis_label_font_size: float = 16, axis_tick_font_size: float = 14, legend_font_size: float = 14, hover_font_size: float = 14, x_range: tuple[float, float] | list[float] | None = None, y_range: tuple[float, float] | list[float] | None = None, y2_range: tuple[float, float] | list[float] | None = None, xaxis_tickformat: str | None = None, trace_name_prefix: dict[str | int, str] | None = None, trace_colors: dict[str | int, str | list[str]] | None = None, color_mode: Literal[original, manual, auto] = 'auto', color_palette: list[str] | None = None, output_dir: str | Path | None = None, output_name: str = 'merged_chart', theme: str = 'plotly_white', output_formats: str | list[str] | None = None, generate_files: bool = True, generate_plot_data: bool = True)
Initialize PlotMerger.
Examples
Only used when color_mode="manual". color_mode : {"original", "manual", "auto"}, default "auto" How to handle trace colors: - "original": Keep colors from source plotters unchanged. - "manual": Use trace_colors dict to override colors by source. - "auto": Automatically assign distinct colors to each trace from the color palette for easy visual distinction. color_palette : list of str, optional Custom color palette for auto-coloring. If None, uses the default Plotly qualitative palette. Only used when color_mode="auto". output_dir : str or Path, optional Directory for output files. - 'workspace' of pipeline has priority over the 'output_dir'. - If both 'output_dir' and 'workspace' are None, the current working directory will be used. output_name : str, default "merged_chart" Base name for output files, not including the extension. theme : str, default "plotly_white" Plotly theme for the merged chart. output_formats : str or list of str, optional Output formats to generate. Options: ["html", "image"] If None, defaults to "html" (only generate HTML file). generate_files : bool, default True Whether to generate output files. generate_plot_data : bool, default True Whether to generate plot data for GDIM platform. **kwargs Additional Plotly layout options passed to update_layout(). These options are stored in ````layout_kwargs```` attribute and can also be modified after construction:: merger = PlotMerger("MyMerger") merger.layout_kwargs["xaxis_tickangle"] = -45 merger.layout_kwargs["plot_bgcolor"] = "white"
Notes
for both trace and layout options, PlotMerger only accepts layout options because traces are copied from source charts. For trace customization in PlotMerger, use the dedicated parameters: ````trace_colors````, ````trace_name_prefix````, ````color_mode````, and ````color_palette````. Common layout options: - xaxis_tickangle : float, rotation angle for x-axis tick labels - plot_bgcolor : str, plot background color - paper_bgcolor : str, paper background color - hovermode : str, hover interaction mode ("x", "y", "closest", "x unified") - And any other Plotly layout options For complete options, see Plotly documentation: - Figure layout: https://plotly.com/python/reference/layout/
Attributes:
- OutputImageFile: PortReference[PortTypeHint.FilePath]
- OutputHtmlFile: PortReference[PortTypeHint.FilePath]
- OutputPlotData: PortReference[PortTypeHint.PlotData]