# How to use Plotly express to create multiple charts in the same figure(I need 3 charts in one figure--one stacked bar chart and two lines)

**URL:** <https://community.plotly.com/t/how-to-use-plotly-express-to-create-multiple-charts-in-the-same-figure-i-need-3-charts-in-one-figure-one-stacked-bar-chart-and-two-lines/33452>\
**Category:** 📊 Plotly Python\
**Created:** [January 10, 2020, 11:12am UTC](https://community.plotly.com/t/how-to-use-plotly-express-to-create-multiple-charts-in-the-same-figure-i-need-3-charts-in-one-figure-one-stacked-bar-chart-and-two-lines/33452 "2020-01-10T11:12:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sameerass](https://avatars.discourse-cdn.com/v4/letter/s/a87d85/32.png) [@sameerass](https://community.plotly.com/u/sameerass)\
**Post date:** [January 10, 2020, 11:12am UTC](https://community.plotly.com/t/how-to-use-plotly-express-to-create-multiple-charts-in-the-same-figure-i-need-3-charts-in-one-figure-one-stacked-bar-chart-and-two-lines/33452/1 "2020-01-10T11:12:13Z")

</div>

Hello there,

I am trying to plot multiple charts in one graph using plotly express. I need to plot one stacked bar chart and two lines in the same figure. I have 5 columns–year,priority,value,opened and closed. I was able to plot stacked bar chart as shown in the code pasted below. Can anyone help me in plotting two more lines–one with ‘opened’ column w.r.t ‘year’ and other with ‘closed’ w.r.t ‘year’. Looking forward for your help. Thanks in advance.  
Tried with add\_trace() but did not work. plotly graph objects is not working in my notebook version as it is showing blank. So plotly express is my only way out now.  
Code to plot stacked bar chart(Please help for drawing two more lines in the same graph):  
import plotly\_express as px  
fig = px.bar(df, x=‘year’, y=‘value’,color=‘priority’,  
hover\_data=[‘priority’, ‘value’],  
labels={‘value’:‘priority’}, height=400)

fig.show()

---

<div class="post-metadata">

**Author:** ![Krichardson](https://avatars.discourse-cdn.com/v4/letter/k/85f322/32.png) [@Krichardson](https://community.plotly.com/u/Krichardson)\
**Post date:** [January 10, 2020, 2:40pm UTC](https://community.plotly.com/t/how-to-use-plotly-express-to-create-multiple-charts-in-the-same-figure-i-need-3-charts-in-one-figure-one-stacked-bar-chart-and-two-lines/33452/2 "2020-01-10T14:40:33Z")

</div>

Hello Sameerass! Welcome to to forum! If I understand your question correctly I believe you are looking for the [make subplots function](https://plot.ly/python/subplots/). This function can be used to create a grid like layout of graphs! Also if you are looking to have subplots with multiple y or x axes [this example](https://plot.ly/python/multiple-axes/#muliple-yaxes-subplots) should help you accomplish that!

Good luck with your project and feel free to post again if you need any more help!

---

<div class="post-metadata">

**Author:** ![Edison](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/edison/32/9312_2.png) [@Edison](https://community.plotly.com/u/Edison)\
**Post date:** [February 7, 2020, 10:46am UTC](https://community.plotly.com/t/how-to-use-plotly-express-to-create-multiple-charts-in-the-same-figure-i-need-3-charts-in-one-figure-one-stacked-bar-chart-and-two-lines/33452/3 "2020-02-07T10:46:06Z")

</div>

hi, same question here…

The above-mentioned subplots solution will work for self-analysis, but for certain scenarios (e.g. presentation purpose), it would be nice to have multiple chart types to fit in one single figure, just like the example here made by graph\_objects - [https://plot.ly/python/graphing-multiple-chart-types/](https://plot.ly/python/graphing-multiple-chart-types/)

Is it possible that we achieve the same by using plotly express? Thanks in advance

 ![截屏2020-02-07下午6.44.37](https://us1.discourse-cdn.com/flex024/uploads/plot/original/2X/d/d56983d4bb5bf366e47d51461b3e2e2d09962bd2.png)

Edison

---

<div class="post-metadata">

**Author:** ![sameerass](https://avatars.discourse-cdn.com/v4/letter/s/a87d85/32.png) [@sameerass](https://community.plotly.com/u/sameerass)\
**Post date:** [February 12, 2020, 10:14am UTC](https://community.plotly.com/t/how-to-use-plotly-express-to-create-multiple-charts-in-the-same-figure-i-need-3-charts-in-one-figure-one-stacked-bar-chart-and-two-lines/33452/4 "2020-02-12T10:14:14Z")

</div>

@Krichardson Thank you for responding. I am not looking for subplots in the same figure. I want all the figures–scatter and bar to be merged in the same trace. I could figure out a way using something like this  
fig.add\_trace(  
go.Figure(data=[  
go.Bar(),  
go.Scatter(),  
go.Table()  
)  
Thanks much!

---

<div class="post-metadata">

**Author:** ![geds133](https://avatars.discourse-cdn.com/v4/letter/g/ac8455/32.png) [@geds133](https://community.plotly.com/u/geds133)\
**Post date:** [June 10, 2020, 2:10pm UTC](https://community.plotly.com/t/how-to-use-plotly-express-to-create-multiple-charts-in-the-same-figure-i-need-3-charts-in-one-figure-one-stacked-bar-chart-and-two-lines/33452/5 "2020-06-10T14:10:19Z")

</div>

You have no closing sqaure bracket for this solution.
