Hi there
I should plot a count bar chart of Dataframe generated from a dict.
Here is my code:
import plotly.offline as py
import plotly.graph_objs as go
import numpy as np
import pandas as pd
#use the next line if you are using notebook
py.init_notebook_mode(connected=True)
d = {'facebook': 1876, 'twitter': 512, 'linkedin': 8, 'pinterest': 18, 'google+': 97, 'instagram': 145}
count_social = pd.DataFrame.from_dict(d,orient='index')
count_social.columns= ['social']
data = [go.Histogram(x=count_social['social'],
histnorm='count',
name='Social accounts'
)]
# IPython notebook
layout = go.Layout(
bargap=0.2,
)
fig = go.Figure(data=data, layout=layout)
py.iplot(fig)
I want six bin on x axes (one for each social network) and count of in y values, but I am unable to get it.
Any help is appreciated!
Thanks