Skip to content

Automattic/automattic_visualization_setup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Automattic-specific style improvement to matplotlib

Data visualization is a pivotal task in the job of a data scientist. matplotlib is one of the most widely used Python data visualization libraries. Being developed in late 1990's to mimic look and feel of Matlab -- then de-facto standard, matplotlib graphs suffer several problems. seaborn is an attempt to solve such problems, and to provide other improvements. This module uses seaborn to create plotting themes that meet WordPress.com color scheme, as well as several other enhancements.

WorPress.com colors are based on the specifications mentioned in the design handbook. Missing colors were added using the excellent iwanthue service.

Usage

WorPress.com color definitions reside in a8c_colors.py.

Importing a8c_styling also imports seaborn and sets the plotting style to a8c_styling.a8c_style.

import a8c_styling
import seaborn as sns
from matplotlib import pylab as plt

plt.figure()
a8c_styling.sinplot(4) #this is how a default plot looks like

This is the result:

sample_sine

Some parameters cannot be changed by the means of set_style. Thus, a8c_styling provides several convenience functions and definitions:

plt.figure()
a8c_styling.sinplot(4)
plt.ylabel('this is Y',
           **a8c_styling.ylabelparams) #horizontal label for
                                    #more readability
plt.title('This is an improved title', **a8c_styling.axtitleparams)
a8c_styling.cleanup()

This is the final design:

improved_sine

License

GPLv2+

About

Matplotlib settings for better appearance and WP.com styling

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published