Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to use PrettyPlotLib

📅 2014-May-19 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ matplotlib, prettyplotlib ⬩ 📚 Archive

A common method to generate plots in Python is to use the matplotlib module. While functional, these plots are not very beautiful to look at. PrettyPlotLib aims to fix this by generating beautiful plots with only small modifications to the code that is already using matplotlib.

I prefer to install this module and its dependencies using Pip:

$ sudo pip install brewer2mpl
$ sudo pip install prettyplotlib

To use this module, change the plot and legend functions in your code to use the prettyplotlib module instead of matplotlib.pyplot.

For example:

# Old code
import matplotlib.pyplot as mplot

mplot.plot(x)
mplot.xlabel("Points")
mplot.ylabel("Time")
mplot.legend(loc="best", numpoints=1)

# New code
import matplotlib.pyplot as mplot
import prettyplotlib as pplot

pplot.plot(x)
mplot.xlabel("Points")
mplot.ylabel("Time")
pplot.legend(loc="best", numpoints=1)

Note: PrettyPlotLib is not being actively developed anymore. Its creator recommends using the Seaborn module with Matplotlib instead.

Tried with: PrettyPlotLib 0.1.7, Python 2.7.6 and Ubuntu 14.04