suboptimumg.plotting.two_panel_spectrum#

suboptimumg.plotting.two_panel_spectrum.plot_two_panel_spectrum(freqs, magnitude_by_series, phase_by_series, *, title='Frequency response', magnitude_label='|H| (dB)', phase_label='phase (deg)', freq_label='frequency (Hz)', log_freq=True, dashed_series=None, font_config=FontConfig(large=24, medium=16, small=12), layout_config=LayoutConfig(width=1000, height=700, grid_width_per_col=400, grid_height_per_row=350, grid_horizontal_spacing=0.08, grid_vertical_spacing=0.12, margin={'l': 70, 'r': 50, 't': 90, 'b': 70}, plot_bgcolor='white', scene_bgcolor='rgba(240, 240, 240, 0.8)', title_x=0.5, title_xanchor='center', title_yanchor='top'))[source]#

Generic stacked magnitude-over-phase (Bode-style) plot.

Two vertically stacked panels share a frequency x-axis: magnitude on top, phase below. Each series is drawn in both panels and linked by a single legend entry, so toggling a series hides both its magnitude and phase curves.

Parameters:
  • freqs (NDArray[float64]) – Shared frequency axis (Hz).

  • magnitude_by_series (dict[str, NDArray[float64]]) – Magnitude curve per series label. Values are plotted verbatim, so pass dB (or linear) already converted.

  • phase_by_series (dict[str, NDArray[float64]]) – Phase curve (deg) per series label; keys must match magnitude_by_series.

  • title (str, optional) – Figure title.

  • magnitude_label (str, optional) – Y-axis label for the magnitude panel.

  • phase_label (str, optional) – Y-axis label for the phase panel.

  • freq_label (str, optional) – Shared x-axis label.

  • log_freq (bool, optional) – Use a logarithmic frequency axis. Default is True.

  • dashed_series (set[str], optional) – Series labels to render dashed (e.g. a comparison model). Default is None (all solid).

  • font_config (FontConfig, optional)

  • layout_config (LayoutConfig, optional)

Return type:

go.Figure