我对 Julia 语言的绘图包 Gadfly 有疑问。假设我有一个如下所示的 DataFrame:
DataFrame:(DrinkType, Country, Month, Sales)
Coke, UK, April, 500
Coke, US, April, 500
Coke, UK, March, 400
Coke, US, March, 700
我想为每个 DrinkType 生成一个条形图,其中颜色分为英国或美国的红色和绿色以闪避风格,以及每个国家的月 3 月和 4 月为浅绿色和浅红色(不透明颜色)以堆叠风格.
结果应该为每种饮料显示 2 个酒吧,例如:
Coke: bar1, stacked US(400 March (light red), 500 April (red))
bar2, stacked UK(700 March (light greed), 500 April (green))
到目前为止,我想出了这个:
t0 = plot(result, y=:Drink, x=:x1, color=:Country, Theme(minor_label_font_size= 12pt, bar_spacing = -0.15cm), Geom.bar(position=:dodge, orientation=:horizontal)
,Scale.color_discrete_manual(Green,Orange),
Guide.title("Overall Drink Trends") , Guide.ylabel(nothing),Guide.xlabel(nothing))
这将分别生成 4 个条形...