santosjorge / cufflinks

Productivity Tools for Plotly + Pandas
MIT License
3.03k stars 676 forks source link

Multiple Chart Type in one Graph #231

Closed Anuj180 closed 4 years ago

Anuj180 commented 4 years ago

df = pd.DataFrame({ 'y1': [3, 1, 5], 'y2': [30, 50, 20] }, index=[1, 2, 3])

is this possible that I can plot 'y1' as a Scatter chart and 'y2' as a line chart in one picture?

Currently using :

fig=cf.tools.figures(df,[{'kind':'bar'},{'kind':'scatter','mode':'markers','color':'red'}]) cf.iplot(fig)

but not working

santosjorge commented 4 years ago

You can try the following

fig=cf.tools.merge_figures([df['y1'].figure(kind='lines',width=3),df['y2'].figure(kind='bar',color='red')])
cf.iplot(fig)

image

santosjorge commented 4 years ago

As per above