Python Forum
How to plot 2 graphs in one figure?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to plot 2 graphs in one figure?
#1
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()
Reply
#2
https://www.geeksforgeeks.org/plot-multi...atplotlib/
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to create a plot with line graphs and vertical bars devansing 6 2,381 Feb-28-2023, 05:38 PM
Last Post: devansing
  Not able to figure out how to create bar plot on aggregate data - Python darpInd 1 2,310 Mar-30-2020, 11:37 AM
Last Post: jefsummers
  It doesn't show scatter plot but it says: "<Figure size 640x480 with 1 Axes>" dcardonaa 0 3,517 Oct-10-2019, 02:34 AM
Last Post: dcardonaa
  plotting of graphs mudezda1 2 2,843 Feb-11-2019, 12:44 PM
Last Post: mudezda1
  How to plot data to the same figure for every run? chry5ler 3 4,808 Aug-03-2018, 04:21 PM
Last Post: heras

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020