2

我正在尝试在Gadfly. 为此,我正在使用free_y_axis = true,它确实有效。但是,当我添加颜色美学 ( color=:product) 时,free_y_axis 似乎不再起作用。有任何想法吗?

绘图的代码是:

using Gadfly
using DataFrames

plot(flow, ygroup=:rawmat_type, x=:period, y=:quantity, color=:product, 
    Geom.subplot_grid(Geom.bar(position=:stack), free_y_axis=true), 
    Theme(background_color="white", bar_spacing=2mm, key_title_font_size=9pt), 
    Scale.y_continuous(format=:plain))

数据帧为:

 Row │ product    rawmat    type  period   quantity   rawmat_type       
─────┼──────────────────────────────────────────────────────────────
   1 │ lemon_pie  cookies  cheap         1   10000.0  cookies_cheap
   2 │ lemon_pie  cookies  cheap         2   10000.0  cookies_cheap
   3 │ lemon_pie  cookies  cheap         3   10000.0  cookies_cheap
   4 │ lemon_pie  cookies  cheap         4   10000.0  cookies_cheap
   5 │ lemon_pie  cookies  cheap         5   10000.0  cookies_cheap
   6 │ brownie    sugar    cane          1     100.0  sugar_cane
   7 │ brownie    sugar    cane          2     100.0  sugar_cane
   8 │ brownie    sugar    cane          3     100.0  sugar_cane
   9 │ brownie    sugar    cane          4     100.0  sugar_cane
  10 │ brownie    sugar    cane          5     100.0  sugar_cane
  11 │ lemon_pie  lemon    cheap         1    1000.0  lemon_cheap
  12 │ lemon_pie  lemon    cheap         2    1000.0  lemon_cheap
  13 │ lemon_pie  lemon    cheap         3    1000.0  lemon_cheap
  14 │ lemon_pie  lemon    cheap         4    1000.0  lemon_cheap
  15 │ lemon_pie  lemon    cheap         5    1000.0  lemon_cheap
  16 │ brownie    cacao    bitter        1     250.0  cacao_bitter
  17 │ brownie    cacao    bitter        2     250.0  cacao_bitter
  18 │ brownie    cacao    bitter        3     250.0  cacao_bitter
  19 │ brownie    cacao    bitter        4     250.0  cacao_bitter
  20 │ brownie    cacao    bitter        5     250.0  cacao_bitter
  21 │ lemon_pie  lemon    premium       1     500.0  lemon_premium
  22 │ lemon_pie  lemon    premium       2     500.0  lemon_premium
  23 │ lemon_pie  lemon    premium       3     500.0  lemon_premium
  24 │ lemon_pie  lemon    premium       4     500.0  lemon_premium
  25 │ lemon_pie  lemon    premium       5     500.0  lemon_premium

我附上了我得到的图,我想在其中释放 y 轴,同时仍然对产品变量使用颜色美学。 面包房地块

谢谢!

4

0 回答 0