popo.plotting#

Network diagrams, figure style, line plots and tables. Needs the plot extra. See Plotting.

Network diagrams

topology_from_dss

Read the active, solved OpenDSS circuit into a NetworkTopology.

plot_topology

Draw a network as a schematic icon diagram, buses coloured by voltage status.

NetworkTopology

The parts of a circuit a topology diagram needs, as plain Python data.

topology_layout

Lay out every bus as a tidy tree grown from root.

bus_roles

Classify buses as source, load, pv or load_pv; unlisted buses are junctions.

voltage_status

Classify a per-unit voltage against fixed limits: (colour, label).

Figure style

configure

Apply popo's figure style globally: BASE_RC, LaTeX settings if used, then POPO_RC.

style

Apply popo's style for the duration of a block, then restore.

sketch

Popo's style with hand-drawn lines, for concept illustrations rather than results.

panel

Size for one panel occupying fraction of a notional text width.

pad_limits

(min, max) across every array in value_arrays, padded by frac of the range.

tex_safe

Escape a string for LaTeX, for anything interpolated from data.

Line plots

configure

Apply popo's figure style with the compact line-plot sizes on top.

new_panel

A single-axes figure authored at its final size (fraction of the text width).

hour_axis

Lead time in hours (0 to 24) shown as time of day; every forecast window starts at 00:00.

set_y_axis

Y-limits and ticks from the plotted data.

reference_line

A horizontal reference (nominal level, zero, record mean) in the uniform dotted style.

legend_below

One-row legend centred below the axes; save() places it LEGEND_GAP_PT below the x-axis label.

finish

Left and bottom spines only, ticks pointing out, no minor ticks.

show

Lay out the figure and its legends as save() does, then display it inline without writing files.

save

Write a PDF and a 600 dpi PNG, tightly cropped, with legends placed below the axes.

Tables

themed_gt

Apply popo's table style to a Great Tables table or a DataFrame.

record_table

A two-column statistic | value table for a one-row summary.

metrics_report

A themed metric-comparison table with each column's best value highlighted.

popo.plotting.tokens holds the palette, PALETTE, and the colours named by role: PRIMARY for the subject of a figure, INFO and WARNING for supporting series, DANGER for a failure and TEXT_MUTED for context.