saving images in python at a very high quality

How can I save python plots at very high quality?

That is, when I keep zooming in on the object saved in a pdf file, there is no blurring?

Also, what would be the best mode to save it in?

png, eps? Or some other? I can't do pdf because there is a hidden number that happens that mess with Latexmk compilation.

If you are using matplotlib and trying to get good figures in a latex document, save as an eps. Specifically, try something like this after running the commands to plot the image:

    plt.savefig('destination_path.eps', format='eps', dpi=1000)

I have found that eps files work best and the dpi parameter is what really makes them look good in a document.

UPDATE:

To specify the orientation of the figure before saving simply call the following before the plt.savefig call, but after creating the plot (assuming you have plotted using an axes with the name ax):

    ax.view_init(elev=elevation_angle, azim=azimuthal_angle)

Where elevation_angle is a number (in degrees) specifying the polar angle (down from vertical z axis) and the azimuthal_angle specifies the azimuthal angle (around the z axis).

I find that it is easiest to determine these values by first plotting the image and then rotating it and watching the current values of the angles appear towards the bottom of the window just below the actual plot. Keep in mind that the x, y, z, positions appear by default, but are replaced with the two angles when you start to click+drag+rotate the image.

From: stackoverflow.com/q/16183462