这是dataframe:
import pandas as pd
from statsmodels.graphics.mosaicplot import mosaic
df = pd.DataFrame({'size' : ['small', 'large', 'large', 'small', 'large', 'small'],
'length' : ['long', 'short', 'short', 'long', 'long', 'short']})
如果我绘制mosaic(df, ['size', 'length'])
,它将按此顺序显示size
small
然后large
,而我希望large
然后{{} 1}}。有没有办法实现它?
答案 0 :(得分:2)