Since, i'm a newbie to python. I was trying to save a plot using matplotlib in python with the command plt.savefig()
.
The problem is that the image being save is low in resolution. Unable to read data points.
I was wondering if there is a way to save such figures in a very high resolution?
Copy the graph in Excel (CTRL+C) and paste into PowerPoint as a Microsoft Excel object. (The PPT slide size should be set to match the size of the graph using the Slide Size option in the Design tab). From there, right-click on the slide, select “Save as Picture”, and then use the PNG file format option.
To save a figure as an image at a specific resolution, call the exportgraphics function, and specify the 'Resolution' name-value pair argument. By default, images are saved at 150 dots per inch (DPI). For example, create a bar chart and get the current figure. Then save the figure as a 300-DPI PNG file.
To save the file in pdf format, use savefig() method where the image name is myImagePDF. pdf, format="pdf". We can set the dpi value to get a high-quality image. Using the saving() method, we can save the image with format=”png” and dpi=1200.
Use a resolution that uses specific sizing that is large :
fig = plt.figure(figsize=(19.20,10.80))
produces 1080p for example and you can go much higher than this.
You can use savfig()
to export to an image file with specification of the dpi:
import matplotlib.pyplot as plt
...
plt.savefig('plot_name.png', dpi = 300)
You can choose needed dpi by yourself. I hope it will be useful for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With