我想为以下数据框创建一个灰色形状的华夫饼图
data = pd.DataFrame({'Category': ['a', 'b', 'c', 'd'], 'no_occurrence' : [594, 5, 10, 9]})
这是我到目前为止根据这篇文章所做的
import matplotlib.pyplot as plt
from pywaffle import Waffle
fig = plt.figure(
FigureClass=Waffle,
rows=5,
colors = ('lightgrey', 'black', 'darkgrey', 'lightgrey'),
values=list(data['no_occurrence']/4),
labels=list(data['Category']),
icons = 'sticky-note',
icon_size = 11,
figsize=(12, 8),
icon_legend = True,
legend={'loc': 'lower left','bbox_to_anchor': (0, -0.4), 'ncol': len(data), 'fontsize': 8}
)
由于灰色的形状很难区分,我想孵化最后一个类别(在图中和图例中),但我不知道如何在颜色中添加阴影。我有一个具有相同类别的条形图,我在其中添加了阴影,所以我想保持一致。