yhat / ggpy

ggplot port for python
http://yhat.github.io/ggpy/
BSD 2-Clause "Simplified" License
3.69k stars 573 forks source link

Can't facet on variable with more than 9 levels #663

Open shelmich opened 5 years ago

shelmich commented 5 years ago

This code works:

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')

This code fails with error: Bin edges must be unique: array([ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,

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')

The only thing that has changed is removing the 0 from 10 in 'facet_var'.