Python Forum
How to plot 2 graphs in one figure? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Data Science (https://python-forum.io/forum-44.html)
+--- Thread: How to plot 2 graphs in one figure? (/thread-37029.html)



How to plot 2 graphs in one figure? - man0s - Apr-24-2022

The below code returns 2 seperate graphs, how can I combine them in one figure?
sns.set()
sns.set_context("notebook")
sns.set_style("darkgrid", {"axes.facecolor":"0.9",'font.family':['Roboto']})

pltsize = (10,7)

yrlsum.plot(x='year', y='TAVG', kind='bar', legend=False, figsize=pltsize,
        color=(yrlsum['TAVG'] > 0).map({True:'darkorange', False:'royalblue'}))

yrlsum['MA'] = yrlsum['TAVG'].rolling(window=10).mean()

yrlsum.plot(x='year', y='MA', kind='line', legend=False, figsize=pltsize,
        color='black', lw=1)

plt.show()



RE: How to plot 2 graphs in one figure? - Axel_Erfurt - Apr-25-2022

https://www.geeksforgeeks.org/plot-multiple-plots-in-matplotlib/