7

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?

Roopa
  • 79
  • 1
  • 1
  • 4

3 Answers3

7

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.

Vasyl Lyashkevych
  • 1,920
  • 2
  • 23
  • 38
6

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.

Eamonn Kenny
  • 1,926
  • 18
  • 20
2
savefig(fname, dpi=None, facecolor='w', edgecolor='w',
    orientation='portrait', papertype=None, format=None,
    transparent=False, bbox_inches=None, pad_inches=0.1,
    frameon=None)

you can use dpi=300 or other values

Rockbar
  • 1,081
  • 1
  • 20
  • 31