Colormaps
Import Colormaps
To import the statworx theme colormaps to a matplotlib, simply run the apply_style functions as shown below.
Now you can call these colormaps by their name like their native counterparts. Note that the name of all statworx colormaps start with stwx:.
# mkdocs: render
from statworx_theme import apply_style
apply_style()
List of Available Colormaps
Discrete Maps
# mkdocs: render
plot_color_gradients('Discrete Statworx Themes',
['stwx:standard', 'stwx:alternative', 'stwx:deep'])
Continous Maps
# mkdocs: render
plot_color_gradients('Qualitative Statworx Themes',
['stwx:good2bad', 'stwx:bad2good'])
# mkdocs: render
plot_color_gradients(
"Fading Statworx Themes", [f"stwx:{c}_fade" for c in ["Bl", "Rd", "Gn", "Yw"]]
)
# mkdocs: render
from itertools import product
color_names = ["Bl", "Rd", "Gn", "Yw"]
plot_color_gradients(
"Blending Statworx Themes",
[f"stwx:{c1}{c2}_blend" for (c1, c2) in product(color_names, color_names) if c1 != c2],
)
# mkdocs: render
from itertools import product
color_names = ["Bl", "Rd", "Gn", "Yw"]
plot_color_gradients(
"Diverging Statworx Themes",
[f"stwx:{c1}{c2}_diverging" for (c1, c2) in product(color_names, color_names)],
)
# mkdocs: render
from itertools import product
color_names = ["Bl", "Rd", "Gn", "Yw"]
plot_color_gradients(
"Rising Statworx Themes",
[f"stwx:{c}_rise" for c in color_names],
)
Usage
# mkdocs: render
import seaborn as sns
import matplotlib.pyplot as plt
# Load the example flights dataset and convert to long-form
flights_long = sns.load_dataset("flights")
flights = flights_long.pivot("month", "year", "passengers")
# Draw a heatmap with the numeric values in each cell
f, ax = plt.subplots(figsize=(9, 6))
sns.heatmap(flights, annot=True, fmt="d", linewidths=.5, ax=ax, cmap="stwx:good2bad")
# mkdocs: render
import seaborn as sns
import matplotlib.pyplot as plt
# Load the example flights dataset and convert to long-form
flights_long = sns.load_dataset("flights")
flights = flights_long.pivot("month", "year", "passengers")
# Draw a heatmap with the numeric values in each cell
f, ax = plt.subplots(figsize=(9, 6))
sns.heatmap(flights, annot=True, fmt="d", linewidths=.5, ax=ax, cmap="stwx:Bl_fade")
# mkdocs: render
import seaborn as sns
import matplotlib.pyplot as plt
# Load the example flights dataset and convert to long-form
flights_long = sns.load_dataset("flights")
flights = flights_long.pivot("month", "year", "passengers")
# Draw a heatmap with the numeric values in each cell
f, ax = plt.subplots(figsize=(9, 6))
sns.heatmap(flights, annot=True, fmt="d", linewidths=.5, ax=ax, cmap="stwx:Rd_rise")