import matplotlib.pyplot as plt
from pywaffle import Waffle
= plt.subplots(1, 1, num=1, clear=True)
fig, ax
="equal")
ax.set_aspect(aspect
Waffle.make_waffle(=ax,
ax=5,
rows=10,
columns=[30, 16, 4],
values={"label": "Waffle", "loc": "left"}
title )
Waffle plot
Let’s decorate waffle plot with matplotlib image effects.
Let’s start with a simple waffle plot, created using the pywaffle package.
Let’s apply some imageeffect.
from mpl_visual_context.patheffects import ImageEffect
from mpl_visual_context.image_effect import Pad, LightSourceSharp
= ImageEffect(Pad(10) | LightSourceSharp(dist_max=7, azdeg=215, altdeg=70,
pe_waffle1 =0.97,
fraction=0.2,
vert_exag
))
for p in ax.patches:
p.set_path_effects([pe_waffle1])
Another effect.
from mpl_visual_context.image_effect import LightSource
= ImageEffect(Pad(10) | LightSource(azdeg=215))
pe_waffle2
for p in ax.patches:
p.set_path_effects([pe_waffle2])