22 · boxplot¶
series.boxplot draws a box-and-whisker of a 1-D sample (cleopatra HistogramGlyph).
Setup — inline plots and the path to the bundled Lisbon DEM.
In [1]:
Copied!
%matplotlib inline
from pathlib import Path
# Locate the bundled Lisbon DEM from the repo root (works from docs/ or the repo root).
ROOT = Path.cwd()
while not (ROOT / "examples" / "data" / "LisbonElevation.tif").exists() and ROOT != ROOT.parent:
ROOT = ROOT.parent
DEM = str(ROOT / "examples" / "data" / "LisbonElevation.tif")
import numpy as np
import matplotlib.pyplot as plt
from digitalearth.static.charts import series
rng = np.random.default_rng(0)
%matplotlib inline
from pathlib import Path
# Locate the bundled Lisbon DEM from the repo root (works from docs/ or the repo root).
ROOT = Path.cwd()
while not (ROOT / "examples" / "data" / "LisbonElevation.tif").exists() and ROOT != ROOT.parent:
ROOT = ROOT.parent
DEM = str(ROOT / "examples" / "data" / "LisbonElevation.tif")
import numpy as np
import matplotlib.pyplot as plt
from digitalearth.static.charts import series
rng = np.random.default_rng(0)
Box-and-whisker of a sample.
In [2]:
Copied!
fig, ax = plt.subplots(figsize=(5, 4))
series.boxplot(rng.normal(0, 1, 500), ax=ax)
ax.set_title('boxplot')
fig;
fig, ax = plt.subplots(figsize=(5, 4))
series.boxplot(rng.normal(0, 1, 500), ax=ax)
ax.set_title('boxplot')
fig;