Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to change DPI in Matplotlib

📅 2015-Jul-29 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ dpi, matplotlib, matplotlibrc ⬩ 📚 Archive

Matplotlib can be used to output plot to PNG image files. To render for this bitmap format, Matplotlib uses a default DPI of 100. This is a surprisingly low DPI for plots. Thankfully, the DPI can be changed easily.

using matplotlib.pyplot as mplot
mplot.savefig("foo.png", dpi=300)
savefig.dpi: 300

Tried with: Matplotlib 1.4.3, Python 2.7.6 and Ubuntu 14.04