Resolved: Saving the graph
When I am using
plt.savefig("Used-Cars.png")
Opening the resulting file returns an empty graph
Hi Eslam,
thanks for reaching out! There is a small error in the video lesson, you need to write plt.savefig()
before plt.show()
like so:
plt.savefig("Used-Cars.png")
plt.show()
And you should have the picture saved correctly.
Let me know if that solve the issue.
Best,
365 Eli
Yes, it works now!
Thanks
The saved file is truncated from bottom side and the X-axis does not come complete. See below the visualization. What is the remedy?
Hi Dhaivat,
thanks for reaching out! You can try a couple of options to save the figure in its full size.
1. Add the bbox_inches argument when saving your picture, like so:
plt.savefig(filename, bbox_inches = 'tight')
2. Before creating your plot, run the following code:
plt.tight_layout()
3. If the two above don't work you can try and save your figure as a pdf, like so:
plt.savefig('X:/' + newName + '.pdf')
Let me know if these work for you.
Best,
365 Eli