Skip to main content

Django-Plottings

Read the Docs Python package

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.

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 useful for background task geneartion.

To create a Django view that returns a PNG file with the plot. In the views.py file:

...
from plottings import PNGViewPlot
...

class PlotView(PNGViewPlot):
    def get_plot_data(self):
        return np.random.rand(20)

    def get_plot_options(self):
        return {"color": "blue"}

    @staticmethod
    def plotter_function(data, color="orange"):
        fig, ax = plt.subplots()
        ax.plot(data, '-o', ms=20, lw=2, alpha=0.7, mfc=color)
        ax.grid()
        return figure

And in the urls.py:

urlpatterns = [
    ...
    path("myplot", views.PlotView, name="plot"),
    ...
    ]

Release files for django-plottings 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-plottings 0.0.3
File Size Uploaded
django_plottings-0.0.3.tar.gz 5.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-plottings 0.0.3
File Interpreter ABI Platform
django_plottings-0.0.3-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 11.9 kB

Release files / django_plottings-0.0.3.tar.gz

Download URL django_plottings-0.0.3.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
f0af9d975574919788e9e93932135bf5372e9520070c711a2a3ae78c7f0cf009
BLAKE2b-256 checksum
How to use checksums
9a77fb23d499b5860a05854c38236344bbd9863921299c15a0943e089423da7f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4

Release files / django_plottings-0.0.3-py2.py3-none-any.whl

Download URL django_plottings-0.0.3-py2.py3-none-any.whl
Size 6.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
7959f80ce3283c14b6aa8fec6eb30a8d781f6c4f42ff595ee2a2793528b3b224
BLAKE2b-256 checksum
How to use checksums
85066e8267bc3eb0ee43445311787fb42c8675a877e3bd34498cf6fcab5017df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page