Zachary Wolfe edited this page Jul 31, 2017 · 14 revisions

Intro

      WolfeStyle is a matplotlib python style sheet designed to portray more modern plot visuals from other software like Mathematica. I'm personally not overly fond of the default stylesheet and none of the other included stylesheets really met my needs. Hence, the Wolfe stylesheet. This stylesheet is based upon the included stylesheet 'bmh', by Cameron Davidson-Pilon.

      The standard style sheet renders a 681 x 545 px image that is well suited for web and other electronic presentation media. The high res version renders a 2549 × 2044 px image and is used to save the figures as a file and is intended to strictly be used for print media.

This is a work in progress

Two Versions

      Two versions are included in the repo. 'wolfe.mplstyle' and 'wolfe_hr.mplstyle'. These have only one difference, wolfe_hr (meaning high resolution) is suitable for printing letter-sized pictures, saving as picture files. the high res version is not suitable for working in-line such as with a Conda notebook. This is reserved for wolfe.mplstyle. Using the high res version in line has a tendency to post very large pictures that don't display properly in notebooks.

      The standard style sheet prints a large-sized photo suitable to display on monitors but the DPI settings are too low to make it suitable for print in all but the smallest cases. The high res version generates a gigantic photo, way to large to really be usable on a monitor without shrinking it by 60% or more, a result of bumping the DPI setting up high enough to make it suitable for printing. I have not yet found a workaround for this. One could simply change the DPI settings of the standard style sheet in-line as well.

Best Practice

      The best practice is to only use wolfe_hr.mplstyle for saving picture files to be shrunk as needed for print. Which simply means use wolfe.mplstyle for all other work until the final image is ready to be exported and simply change the style sheet used and save the picture as a file rather than showing it in line.

Summary

wolfe.mplstyle wolfe_hr.mplstyle
DO: Use for in-line coding Use for printing
DO NOT: Use for printing Use for in-line coding

A dependency

      One dependency does exist. The style requires the font 'Comfortaa', A beautiful, free font from ajohan (aajohan@gmail.com). Most Linux distributions include this font by default, but just in case I have also uploaded the font to this repo. Download it and install as per your OS' requirements.

Importing in Python

      Pulled directly from matplotlib.org

You can create custom styles and use them by calling style.use with the path or URL to the style sheet. Alternatively, if you add your .mplstyle file to ~/.matplotlib/stylelib (you may need to create this directory), you can reuse your custom style sheet with a call to style.use(). Note that a custom style sheet in ~/.matplotlib/stylelib will override a style sheet defined by matplotlib if the styles have the same name.

      Note that I have not been able to make the above work if the Python libraries are running through Conda notebooks (IE: when matplotlib is called from ~/anaconda3/pkgs/). In that case, just place wolfe.mplstyle in the same folder as the other .mplstyle files or use the entire path to the file when calling stlyle.use:

plt.style.use('~/home/[user]/[path to file]/wolfe.mplstyle')

Examples with Default Sizes and Options

Note: these images can be pulled from this repo to view sizes natively.

BMH Default
Seaborn Wolfe
Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.