Skip to main content

A library to generate Matplotilib graphics within django applications

Project description

Django-Plottings

A library to generate Matplotlib graphics within Django applications.

Matplotlib is a Python library for mathematical graphics representations, widely used in science in general and data science in particular.

Django is the leading framework for building web applications in the Python ecosystem.

About

This library is built with the intention of speeding up the building of data science webapps by generating graphics on the server side.

The library provides three different ways to use the rendered graphics:

  • as a view to be served as a standalone graphics file
  • as a text variable to be rendered within a webpage
  • as a file to be saved and served lately

Example

In the django views.py file:

class PlotView(PNGPlotView):
    def get_data(self):
        return [(x.date, x.words) for x in Docs.objects.all()]

    @staticmethod
    def plotter_function(data):
        ...
        return fig

Documentation

Link to Read the Docs.

Good practices

Remember to disable graphics displays with matplotlib.use('Agg') in the header of the plots file.

Cache

As these tasks are computationally expensive is a good practice to cache them once they are generated. This library is designed to integrate with the Django's cache framework.

Project details


Download files

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

Source Distribution

django_plottings-0.0.1.tar.gz (7.5 kB view hashes)

Uploaded Source

Built Distribution

django_plottings-0.0.1-py2.py3-none-any.whl (9.9 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page