Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

mpltex is a python package for creating publication-quality plots using matplotlib.

Project Description

mpltex is a python package for producing publication quality images using matplotlib. Inspired by Olga Botvinnik’s python package prettyplotlib.

The internal matplotlib color cycle is replaced by ColorBrewer Set1 scale which looks less saturated and more pleasing to eyes. For more information on ColorBrewer, see a flash-based interactive map and a quick visual reference to all ColorBrewer scales.

mpltex also enable cycle line styles and a selected set of line markers. Hollow markers are supported.

Quickstart

1. Install

$ pip install mpltex

Required Packages

  • matplotlib. Can be installed via pip install matplotlib.
  • brewer2mpl. Can be installed via pip install brewer2mpl.

2. Usage

Examples and sample plots can be found here.

Following is a brief introduction. Just add one of mpltex decorators before your plot functions.

import mpltex

@mpltex.acs_decorator
def your_plot():
    # plot images by matplotlib ...

    # Save the image. Give a file name without extension.
    # You can also save figure outside your_plot if you like.
    fig.save_fig('/path/to/save/fig/figname')

# Then use your_plot in a normal way.
your_plot()

And it will create a plot ready for publishing in journals published by American Chemical Society (ACS).

mpltex also contains several helper functions to facilitate production of specific type of images. Following codes will produce a set of line arts with cycled line styles and line markers with the help of mpltex.linestyle_generator function.

import matplotlib.pyplot as plt
import mpltex

@mpltex.acs_decorator
def your_plot():
    # ...   # generate data x and y
    fig, ax = plt.subplots(111)

    # The default line style is iterating over
    # color, line, and marker with hollow types.
    linestyles = mpltex.linestyle_generator()

    for i in range(number_of_lines):
        ax.plot(x[i], y[i], label=str(i), **linestyles.next())

    ax.locator_params(nbins=5)  # limit the number of major ticks
    ax.legend(loc='best')  # show legend in a best location
    fig.tight_layout(pad=0.1)  # make layout as tight as possible
    fig.savefig('/path/to/save/fig/figname')

Available Decorators

  • mpltex.acs_decorator: output EPS images for publishing in ACS.
  • mpltex.rsc_decorator: output EPS images for publishing in RSC.
  • mpltex.presentation_decorator: output PDF images for presentation slides (Keynote).
  • mpltex.web_decorator: output PNG images for web pages.

Contribute

Let me know what you think and wish. I can be reached through email or other ways. Or fork the project at github.com and file a pull request.

Release History

Release History

This version
History Node

0.4.1

History Node

0.4

History Node

0.3.1

History Node

0.3

History Node

0.2.3

History Node

0.2.2

History Node

0.2.1

History Node

0.2

History Node

0.1.2

History Node

0.1.1

History Node

0.1

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
mpltex-0.4.1.tar.gz (9.6 kB) Copy SHA256 Checksum SHA256 Source Dec 2, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting