I'm trying to graph a pie chart using myplotlib, and I was able to set the spacing and the end result with plt.show()
is exactly what I want. However whenever I try to save my figure using plt.savefig("file path name here.png")
The title and portions of the labels are cut off.
I have tried using plt.tight_layout()
however, that completely removes all the spacing I set up beforehand. I also tried plt.savefig("file path name.png", dpi=...)
however that just increases the size of the saved png creating a bigger image that has its title and labels cut off.
Dict_July=dict(Apps["July"].value_counts())
Dict_Aug=dict(Apps["August"].value_counts())
Dict_Sept=dict(Apps["September"].value_counts())
Dict_Oct=dict(Apps["October"].value_counts())
Dict_Nov=dict(Apps["November"].value_counts())
Dict_Jan=dict(Apps["January"].value_counts())
Dict_Feb=dict(Apps["Feb/Mar"].value_counts())
Dict_April=dict(Apps["April"].value_counts())
App_Errors=[Dict_July, Dict_Aug, Dict_Sept, Dict_Oct, Dict_Nov, Dict_Jan, Dict_Feb, Dict_April]
App_Names=["None","2020","CRM","Other","3C Logic","Outlook","Act-on","Foxit"]
colors=["c","orangered","lime","gold","mediumorchid","mediumslateblue","fuchsia","mediumspringgreen"]
july_leg_values=[]
july_legend=[]
for x in range(len(App_Names)):
try:
july_leg_values.append(App_Errors[0][App_Names[x]])
july_legend.append(App_Names[x])
except:
"test"
plt.pie(july_leg_values, labels=july_legend,shadow=True,colors=colors, autopct="%1.1f%%", radius=1.6, explode=(.1,0,0,0,0,0,0,0))
plt.title("July 2017 App Errors",y=1.3,fontsize=14, fontweight="bold")
plt.savefig("./Images/July_App.png")
Examples of what I created vs what is saved as are here.