此代码有效:
import pandas as pd
from ggplot import *
df = pd.DataFrame(data = {'facet_var': [1,2,3,4,5,6,7,8,9,1], 'hist_var': [1,2,3,4,5,6,7,8,9,0]})
ggplot(aes(x='hist_var'), data = df) + geom_histogram() + facet_wrap('facet_var')
此代码不:
import pandas as pd
from ggplot import *
df = pd.DataFrame(data = {'facet_var': [1,2,3,4,5,6,7,8,9,10], 'hist_var': [1,2,3,4,5,6,7,8,9,0]})
ggplot(aes(x='hist_var'), data = df) + geom_histogram() + facet_wrap('facet_var')
唯一的变化是在最后1个数字上添加0,使它变成10个级别而不是9个级别。