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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django_plottings-0.0.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 365ca5ffe740c6cdf3f81d97fc9b22b9245b6f208b9795cd4328599117da5583 |
|
MD5 | 2aa529ac6c2c2dee8c24874ab4f6023f |
|
BLAKE2b-256 | e29aa2a10c2f9984c511f4a530976265ef15992c4239145ea60b464d91e11bcd |