scatter
scatter
#
Scatter — points over named columns, either axis picked from a menu.
GROUP = 'Group'
module-attribute
#
What the legend and the tooltip call groups.
TIME_OF_DAY = ' (time of day)'
module-attribute
#
The suffix naming the clock-time choice an instants column adds to the menus.
Scatter
#
Bases: Component
Every point over named columns, either axis picked from a menu above the plot.
A column is a quantity per point — a broadcast column (frames.iso) or a
plain list, every column the same length. A value that was never recorded
is absent, and its point sits off the axes showing it; a column with nothing
recorded is left out of the menus, and the plot opens on default only
when both its columns have something to plot. Each axis spans spread standard
deviations of its own column, clamped to that column's range, so one far-off
point cannot squash the rest into a line — and picking a new axis re-frames
it, dragged or zoomed as the reader may have left it. A column named in
spans always spans that fixed range instead, wherever its points fall.
The page carries each value to six significant figures.
A column of instants offers two choices: the instant itself, read as a date,
and its time of day, both in the reader's own time zone. color and
size name number columns that shade and size every point; groups
colours the points by category instead, so a scatter takes one or the other.
cgui.Scatter(
{"Sun altitude (°)": sun.altitude, "ISO": frames.iso, "Cloud (0–1)": weather.cloud},
default=("Sun altitude (°)", "ISO"),
groups=frames.session,
spans={"Sun altitude (°)": (0.0, 90.0)},
)
Source code in capturegraph-ui/capturegraph_ui/charts/scatter.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 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 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | |
__post_init__()
#
Check the props, then that the columns line up and every named column exists.
Raises:
| Type | Description |
|---|---|
ValueError
|
If the columns are of different lengths, |
Source code in capturegraph-ui/capturegraph_ui/charts/scatter.py
html(render)
#
The points as one Vega-Lite scatter, the menus and the per-axis spans built in.
Source code in capturegraph-ui/capturegraph_ui/charts/scatter.py
of(*sources, default=None, groups=None, spread=3.0, spans=None, color=None, size=None)
classmethod
#
A scatter over every quantity of each source, labelled by its type.
A source is an array of records — every field its type marks with a
cg.Quantity becomes a column labelled from it, such as
"Temperature (°C)", spanning the quantity's fixed span where it
declares one — or a dict of further columns, named as given.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*sources
|
Source
|
Arrays of records ( |
()
|
default
|
tuple[str, str] | None
|
The two columns the plot opens on. |
None
|
groups
|
Array | None
|
The category of each point, coloured and listed in the legend. |
None
|
spread
|
float
|
How many standard deviations each axis spans. |
3.0
|
spans
|
dict[str, tuple[float, float]] | None
|
Fixed ranges by column, over any its quantity declares. |
None
|
color
|
str | None
|
The number column that shades each point. |
None
|
size
|
str | None
|
The number column that sizes each point. |
None
|
A default quantity no record carries — no photographs yet — counts
as recorded nowhere, and the plot opens on the first columns instead.
Raises:
| Type | Description |
|---|---|
ValueError
|
If two sources give columns the same label. |
cgui.Scatter.of(
sun,
exif,
exif.gps,
weather,
{"File size (MB)": sizes},
default=("Sun azimuth (°)", "Sun altitude (°)"),
)