Block Colors#

Parameter colors accepts colors in a list or tuple. The length must be same to values, and the acceptable color format includes case-insensitive hex RGB or RGBA, RGB or RGBA tuple, single character notation, case-insensitive X11/CSS4 color name, and more, as long as Matplotlib can recognize. See Matplotlib Colors for the full list.

fig = plt.figure(
    FigureClass=Waffle,
    rows=5,
    columns=10,
    values=[30, 16, 4],
    colors=["#232066", "#983D3D", "#DCB732"]
)
Block Colors

Another method to change block colors is passing Colormap to parameter cmap_name, which sets colors in batch.

NOTE: Sequential colormaps does not work with PyWaffle. Only Qualitative colormaps are supported, including Pastel1, Pastel2, Paired, Accent, Dark2, Set1, Set2, Set3, tab10, tab20, tab20b, tab20c. See the list and color examples in Colormaps in Matplotlib.

fig = plt.figure(
    FigureClass=Waffle,
    rows=5,
    columns=10,
    values=[30, 16, 4],
    cmap_name="tab10"
)
Block Colors with custom cmap_name