python - Numpy integer does not convert to rgb -


i want draw simple bar plot identity python ggplot library. have couple of categorical variables on x-axis , variable on y-axis , fill barplots y-axis value:

import pandas pd ggplot import * import numpy np  a= pd.dataframe(np.arange(5) ,  index = np.arange(5)) a['second_column'] = ['a', 'b', 'c', 'd', 'e'] a.columns = ['first_column', 'second_column'] ggplot(aes(x = 'second_column', y = 'first_column'), data = a) + \ geom_bar(aes(fill = 'first_column'), stat='identity') 

what is:

<repr(<ggplot.ggplot.ggplot @ 0x7f2d70cc12d0>) failed: valueerror: cannot convert argument type <type 'numpy.int64'> rgba array> 

while if remove fill aesthetics:

a= pd.dataframe(np.arange(5) ,  index = np.arange(5)) a['second_column'] = ['a', 'b', 'c', 'd', 'e'] a.columns = ['first_column', 'second_column']  ggplot(aes(x = 'second_column', y = 'first_column'), data = a) + \ geom_bar(stat='identity') 

with no errors , nice output:

enter image description here


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -