π¨ Plot Appearance & Accessibilityο
SounderPy provides several options for changing the presentation of sounding and hodograph figures without changing the underlying atmospheric profile.
In this tutorial you will:
retrieve one observed sounding;
compare light and dark plotting modes;
compare standard and color-deficiency-friendly sounding colors;
save figures and control output resolution;
combine appearance options;
reproduce the same workflow from the SounderPy CLI.
Using the same profile for each comparison makes it easier to see exactly what each plotting option changes.
Retrieve the Example Soundingο
The examples use the OAX observed sounding from 16 June 2014 at 18 UTC.
import sounderpy as spy
data = spy.get_obs_data(
"OAX",
"2014",
"06",
"16",
"18",
hush=True,
)
Light and Dark Soundingsο
Light Modeο
The default SounderPy plot uses a light background:
spy.build_sounding(
data,
dark_mode=False,
radar=None,
map_zoom=0,
)
Dark Modeο
Set dark_mode=True to use the dark-background plotting theme:
spy.build_sounding(
data,
dark_mode=True,
radar=None,
map_zoom=0,
)
The profile data and parameter calculations are unchanged; only the presentation is different.
Light and Dark Hodographsο
The same dark_mode argument is available for standalone hodographs.
Light Mode |
Dark Mode |
Create them with:
spy.build_hodograph(
data,
dark_mode=False,
radar=None,
map_zoom=0,
)
spy.build_hodograph(
data,
dark_mode=True,
radar=None,
map_zoom=0,
)
Color-Deficiency-Friendly Soundingsο
SounderPy can change the dewpoint-trace styling to improve visual distinction for users with color-vision deficiencies.
Standard Colorsο
spy.build_sounding(
data,
color_blind=False,
radar=None,
map_zoom=0,
)
Color-Deficiency-Friendly Colorsο
spy.build_sounding(
data,
color_blind=True,
radar=None,
map_zoom=0,
)
Combining Appearance Optionsο
Appearance options can be combined:
spy.build_sounding(
data,
dark_mode=True,
color_blind=True,
radar=None,
map_zoom=0,
)
Custom Colorsο
Change individual colors with theme. Only the colors you list change; the
rest keep the light or dark color scheme:
spy.build_sounding(
data,
theme={
"temperature": "navy",
"dewpoint": "darkgreen",
"parcel": {"mu": "black"},
},
)
theme also works with dark_mode=True and color_blind=True, and with
hodographs and composites. See Figure Colors for every color that can be
changed.
Zooming into the Lower Atmosphereο
Set ylim to a (bottom, top) pressure range in hPa to focus the skew-T on
one part of the atmosphere, such as the lowest 300 hPa. The rest of the figure
still uses the full profile:
spy.build_sounding(
data,
ylim=(1000, 700),
)
Changing the Watermarkο
spy.set_watermark() changes the logo and credit text on every figure made
afterwards in the same Python session:
spy.set_watermark(
title="MY RESEARCH GROUP",
subtitle="Made with SounderPy",
)
# hide the watermark
spy.set_watermark(show=False)
# restore the default watermark
spy.set_watermark()
See Watermark for every setting.
Saving Figuresο
Set save=True and provide filename to save a figure instead of showing
it interactively:
spy.build_sounding(
data,
dark_mode=True,
radar=None,
map_zoom=0,
save=True,
filename="oax_dark_sounding.png",
)
The default figure resolution is 100 DPI. Increase it with dpi:
spy.build_sounding(
data,
dark_mode=True,
radar=None,
map_zoom=0,
dpi=200,
save=True,
filename="oax_dark_sounding.png",
)
CLI Equivalentsο
Light-mode sounding:
sounderpy obs OAX 2014-06-16 18 \
--plot sounding \
--map-zoom 0
Dark-mode sounding:
sounderpy obs OAX 2014-06-16 18 \
--plot sounding \
--dark-mode \
--map-zoom 0 \
--plot-file oax_dark.png
Color-deficiency-friendly sounding:
sounderpy obs OAX 2014-06-16 18 \
--plot sounding \
--color-blind \
--map-zoom 0 \
--plot-file oax_colorblind.png
Combined:
sounderpy obs OAX 2014-06-16 18 \
--plot sounding \
--dark-mode \
--color-blind \
--map-zoom 0 \
--dpi 200 \
--plot-file oax_dark_colorblind.png
Next Stepsο
Continue to Maps & Radar to control the geographic inset and radar display.
See also: