This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

About tgext.matplotrender

tgext.matplotrender is a TurboGears2 extension that provides a Rendering Engine for MatplotLib Figures.


tgext.matplotrender can be installed from pypi:

pip install tgext.matplotrender

should just work for most of the users.


To enable tgext.matplotrender add the matplotfig renderer to your configuration:


and plug the rendering engine inside your config/

import tgext.matplotrender


Using tgext.matplotrender is as simple as exposing an action with the matplotfig template and returning the figure itself inside the fig key of action returned dictionary.

Given the following figure:

def _make_fig():
    fig = matplotlib.figure.Figure(figsize=(9, 6))
    fig.Name = "Sinewave"
    ax = fig.add_subplot(111)
    t = numpy.arange(0.0, 2.0, 0.01)
    s1 = numpy.sin(2 * numpy.pi * t)
    ax.plot(t, s1, color="k")
    return fig

It can be exposed through TurboGears actions as:

class RootController(TGController):
    def figure(self, *args, **kwargs):
        return dict(fig=_make_fig())

    @expose('matplotfig', render_params=dict(dpi=36))
    def lowres(self, *args, **kwargs):
        return dict(fig=_make_fig())

    def customres(self, *args, **kwargs):
        options = {}
            options['dpi'] = int(kwargs['dpi'])
        return dict(fig=_make_fig(), **options)

Any other value provided in the dictionary will be used as a print_figure argument in matplotlib

Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
tgext.matplotrender-0.0.1.tar.gz (3.3 kB) Copy SHA256 Checksum SHA256 Source Jun 6, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development 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