Hello,
I am new to the plotly visualization.
My sample data set looks like below ( Pandas data frame)
df => dataframe
role priority year Avg_in_Hrs Total_in_Hrs Avg_in_Mnths Total_in_Mnths
A high 2003 34.44 33 344 24323
B medium 2005 43.4 32 4434 24324
C critical 2003 34.55 78 233 5656
D low 2004 98.55 89 65655 5454
E mediun 2003 34.55 45 24243 1312
role column has more than 50 unique values.
I am using plotlyβs cufflinks which bind my pandas directly to plotly. I am using ipython notebook to plot the above data. Below is my code
cf.go_offline() ## Use plotly in offline mode
indexed_df = df.set_index(['role '])
indexed_df.iplot(kind='bar', title='plot',
filename='cufflinks/categorical-bar-chart')
Above code is generating the plot in which on mouse hover I can see the values. However,its not that much interactive so i have tried to add drop-down menu but all values of role column are not coming in my drop-down box
I am plooting it in an offline mode.
Below is the code I am using for drop down menu.
cf.set_config_file(theme='pearl') ## set theme
buttons_1 = list()
offset = -0.5
for n, r in enumerate(list(indexed_df.index.unique())):
n = n + 1
buttons_1.append(dict(
args=['xaxis.range', [offset, offset + 1]],
label=r,
method='relayout'
))
offset += 1
print "number of unique roles are = ",n
buttons_1.append(dict(
args=['xaxis.range', [-0.5, offset]],
label='Reset',
method='relayout'
))
layout = dict(updatemenus=list([
dict(
x=-0.05,
y=0.8,
buttons=buttons_1,
yanchor='bottom'
)
])
)
indexed_df.iplot(kind='bar',title='plotl',
filename='cufflinks/categorical-bar-chart',layout=layout,fill=True,
xTitle='role')
How to overcome with the above issue ? Also I want to add search box to search my role value and display plot only for that value.
I want to add filters to all my columns and share the plot with others.
Thanks