Plot Data Storage¶
PlotDataStorage
¶
Base class for storing plotted data and exporting to CSV.
Provides common label management and CSV writing. Subclasses implement
register_data for their specific data shape and _build_csv_data
to produce the row list written by save.
Source code in src/psPlotKit/data_plotter/plot_data_storage.py
update_labels(xlabel=None, ylabel=None, zlabel=None)
¶
Update axis labels used as CSV column headers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
xlabel
|
Label for the x-axis / x data columns. |
None
|
|
ylabel
|
Label for the y-axis / y data columns. |
None
|
|
zlabel
|
Label for the z-axis / z data (map plots). |
None
|
Source code in src/psPlotKit/data_plotter/plot_data_storage.py
save(file_name)
¶
Save stored data to a CSV file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_name
|
Output file path. The |
required |
Source code in src/psPlotKit/data_plotter/plot_data_storage.py
LineDataStorage
¶
Bases: PlotDataStorage
Store line-plot x/y series for CSV export.
Each registered series keeps its own x and y arrays, allowing
different series to have independent x values and lengths. The CSV
is written with paired columns (x_label, y_label) per series,
padded with empty strings for shorter series.
Example CSV layout::
Series A, , Series B,
x, y, x, y
1.0, 2.0, 0.5, 3.0
2.0, 4.0, 1.5, 6.0
3.0, 6.0, ,
Source code in src/psPlotKit/data_plotter/plot_data_storage.py
register_data(label, xdata, ydata)
¶
Register a line data series.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
Unique name for the series (used as column header). |
required | |
xdata
|
Array-like of x values. |
required | |
ydata
|
Array-like of y values (same length as xdata). |
required |
Source code in src/psPlotKit/data_plotter/plot_data_storage.py
ErrorBarDataStorage
¶
Bases: PlotDataStorage
Store error-bar plot data for CSV export.
Extends the line-data approach with optional xerr and yerr
columns per series. Each series is independent (may differ in x values
and length).
Example CSV layout::
Series A, , , Series B,
x, y, y error, x, y
1.0, 2.0, 0.1, 0.5, 3.0
2.0, 4.0, 0.2, 1.5, 6.0
Source code in src/psPlotKit/data_plotter/plot_data_storage.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 | |
register_data(label, xdata, ydata, xerr=None, yerr=None)
¶
Register an error-bar data series.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
Unique name for the series (used as column header). |
required | |
xdata
|
Array-like of x values. |
required | |
ydata
|
Array-like of y values. |
required | |
xerr
|
Optional array-like of x-direction errors. |
None
|
|
yerr
|
Optional array-like of y-direction errors. |
None
|
Source code in src/psPlotKit/data_plotter/plot_data_storage.py
MapDataStorage
¶
Bases: PlotDataStorage
Store map/contour grid data for CSV export.
Data is written in a grid layout matching the visual map orientation: x values span the top row, y values fill the first column, and z data occupies the interior cells.
Example CSV layout::
first column: y_label, first row: x_label, data: z_label
z_label, x1, x2, x3
y1, z11, z12, z13
y2, z21, z22, z23
y3, z31, z32, z33
Source code in src/psPlotKit/data_plotter/plot_data_storage.py
register_data(xdata, ydata, zdata)
¶
Register map grid data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
xdata
|
1-D array-like of x-axis values (columns). |
required | |
ydata
|
1-D array-like of y-axis values (rows). |
required | |
zdata
|
2-D array-like of shape |
required |
Source code in src/psPlotKit/data_plotter/plot_data_storage.py
BarDataStorage
¶
Bases: PlotDataStorage
Store bar-plot data (lower and upper bounds) for CSV export.
Each registered bar records the bottom (lower) value and the top (upper) value of the bar.
Example CSV layout::
label, lower, upper
Bar A, -10, 10
Bar B, -25, 15
Source code in src/psPlotKit/data_plotter/plot_data_storage.py
register_data(label, lower, upper)
¶
Register a single bar's range.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
Bar identifier / category name. |
required | |
lower
|
Lower (bottom) value of the bar. |
required | |
upper
|
Upper (top) value of the bar. |
required |
Source code in src/psPlotKit/data_plotter/plot_data_storage.py
BoxDataStorage
¶
Bases: PlotDataStorage
Store box-plot percentile data for CSV export.
Each registered box records five percentile values: the user-defined lower whisker, 25th, 50th (median), 75th percentile, and the user-defined upper whisker.
Example CSV layout::
label, 5th percentile, 25th percentile, 50th percentile, 75th percentile, 95th percentile
Box A, 1.2, 2.5, 3.1, 4.0, 5.3
Source code in src/psPlotKit/data_plotter/plot_data_storage.py
register_data(label, data, whiskers=None)
¶
Register box-plot data from raw values.
Computes the five percentile values (lower whisker, 25th, 50th, 75th, upper whisker) from data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
Box identifier / category name. |
required | |
data
|
Array-like of raw data values. |
required | |
whiskers
|
Two-element list |
None
|