Python Forum
Fig.savefig saving wrong graph
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Fig.savefig saving wrong graph
#1
I am attempting to graph and save temperature and humidity daily data here, which appears to be working fine. Though a extra graph pops up before the one with the data on it, and when I attempt to save using fig.savefig() function it only saves the blank graph. Any idea why the blank graph is popping up? Code and images posted below.

fig,ax = plt.subplots()

ax = data_fr.plot(x='Time',y='Temp',color='r',figsize = (10,5))
ax2 = data_fr.plot(x='Time',y='RH',secondary_y=True,color='g',ax=ax,figsize = (10,5))
plt.title('Temperature and RH Daily Graph')
ax.set_ylabel('C')
ax2.set_ylabel('%')
plt.tight_layout()
name = str(file[:-9])+ ' T-RH Graph.png'
fig.savefig(name, dpi=fig.dpi)
Image of the two graphs here: https://github.com/WxExplorer/Weather_St...0Error.png
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Am I wrong or is Udemy wrong? String Slicing! Mavoz 3 2,532 Nov-05-2022, 11:33 AM
Last Post: Mavoz
  python gives wrong string length and wrong character thienson30 2 2,985 Oct-15-2019, 08:54 PM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

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