perda.plotting.data_instance_plotter#
- perda.plotting.data_instance_plotter.plot_dual_axis(left_data_instances, right_data_instances, timestamp_unit, title=None, left_y_axis_title=None, right_y_axis_title=None, show_legend=True, font_config=FontConfig(large=20, medium=14, small=10), layout_config=LayoutConfig(width=1200, height=700, margin={'l': 70, 'r': 50, 't': 90, 'b': 70}, plot_bgcolor='white', title_x=0.5, title_xanchor='center', title_yanchor='top', grid_width_per_col=400, grid_height_per_row=350, grid_horizontal_spacing=0.08, grid_vertical_spacing=0.12, max_display_resolution=50), vlines=None, vline_config=VLineConfig(color='gray', width=2, dash='dash', opacity=0.7), max_points=None)[source]#
Plot DataInstances on dual y-axes using Plotly.
- Parameters:
left_data_instances (List[DataInstance]) – List of DataInstance objects to plot on the left y-axis
right_data_instances (List[DataInstance]) – List of DataInstance objects to plot on the right y-axis
timestamp_unit (Timescale) – Timestamp unit in the underlying data. Converted to seconds for x-axis display. Pass
aly.data.timestamp_unit.title (str | None, optional) – Title for the entire plot.
left_y_axis_title (str | None, optional) – Label for the left y-axis.
right_y_axis_title (str | None, optional) – Label for the right y-axis.
show_legend (bool, optional) – Whether to show plot legends. Default is True
font_config (FontConfig, optional) – Font configuration for plot elements.
layout_config (LayoutConfig, optional) – Layout configuration for plot dimensions.
vlines (List[float] | None, optional) – X-axis positions (in seconds) where vertical lines are drawn. Default is None.
vline_config (VLineConfig, optional) – Visual configuration for the vertical lines.
max_points (int | None, optional) – Maximum number of data points to plot per trace (enables zero-copy step downsampling). Default is None (full fidelity).
- Return type:
go.Figure
Examples
>>> from perda.plotting import plot_dual_axis >>> fig = plot_dual_axis( ... [speed_di], ... [torque_di], ... left_y_axis_title="Speed (mph)", ... right_y_axis_title="Torque (Nm)", ... timestamp_unit=aly.data.timestamp_unit, ... )
- perda.plotting.data_instance_plotter.plot_single_axis(data_instances, timestamp_unit, title=None, y_axis_title=None, show_legend=True, layout_config=LayoutConfig(width=1200, height=700, margin={'l': 70, 'r': 50, 't': 90, 'b': 70}, plot_bgcolor='white', title_x=0.5, title_xanchor='center', title_yanchor='top', grid_width_per_col=400, grid_height_per_row=350, grid_horizontal_spacing=0.08, grid_vertical_spacing=0.12, max_display_resolution=50), font_config=FontConfig(large=20, medium=14, small=10), vlines=None, vline_config=VLineConfig(color='gray', width=2, dash='dash', opacity=0.7), max_points=None)[source]#
Plot one or more DataInstances on a single y-axis using Plotly.
- Parameters:
data_instances (List[DataInstance]) – List of DataInstance objects to plot
timestamp_unit (Timescale) – Timestamp unit in the underlying data. Converted to seconds for x-axis display. Pass
aly.data.timestamp_unit.title (str | None, optional) – Title for the entire plot.
y_axis_title (str | None, optional) – Label for the y-axis.
show_legend (bool, optional) – Whether to show plot legends. Default is True
layout_config (LayoutConfig, optional)
font_config (FontConfig, optional)
vlines (List[float] | None, optional) – X-axis positions (in seconds) where vertical lines are drawn. Default is None.
vline_config (VLineConfig, optional) – Visual configuration for the vertical lines.
max_points (int | None, optional) – Maximum number of data points to plot per trace (enables zero-copy step downsampling). Default is None (full fidelity).
- Return type:
go.Figure
Examples
>>> from perda.plotting import plot_single_axis >>> fig = plot_single_axis( ... [speed_di, torque_di], ... title="Speed & Torque", ... y_axis_title="Value", ... timestamp_unit=aly.data.timestamp_unit, ... )