PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, June 27, 2022

[FIXED] Why isn't my matplotlib pie chart saving as a png image properly?

 June 27, 2022     graph, image, matplotlib, png, python     No comments   

Issue

Here is an image of my code: enter image description here

When I open my file explorer and try to view this image only a plain white image is displayed:

enter image description here

You can see that my bar chart images have saved just fine, so I'm a bit confused as to why the pie charts aren't viewable.

Anyone know what the problem might be??


Solution

You must write like this:

plt.savefig("Visualsations/plot2.png",dpi=300) 
         
plt.show()  

Save the figure first, and then use plt.show() to show it. The order matters; always check it.



Answered By - Yasin ÜNGÖREN
Answer Checked By - Terry (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing