덕분에 : x 및 매핑이 https://github.com/has2k1/plotnine/issues/94
경우는 범주, 그것은 존경을 명령했다.
from plydata import *
from plotnine import *
from plotnine.data import mpg
# count the manufacturer and sort by the count (see, plydata documentation
# or find out how to do the same thing using raw pandas)
m_categories = (
mpg
>> count('manufacturer', sort=True)
>> pull('manufacturer')
)
df = mpg.copy()
df['manufacturer'] = pd.Categorical(df['manufacturer'], categories=m_categories, ordered=True)
(ggplot(df) +
aes(x='manufacturer') +
geom_bar(size=20) +
coord_flip() +
ggtitle('Number of Cars by Make')
)