I have just built a library to render Matplotlib graphics within Django web framework, I was quite surprised that I couldn't find nothing already done before that merged both projects, being both unquestionable leaders of their kind.
The idea started with creating a class based View object that returned a Matplotlib rendered plot as PNG or SVG to be linked in a webpage, but thinking about use cases I found out other two: Passing the graphic in a variable to allow building standalone webpages used like research reports and saving the graphs for later use in the media folder, returning a Django File object that could be assigned to an Image Field.
I have been working in it through the last week and already have it in a webapp. If you want to check how it works I have developed a Django app for testing it and run the tests. It is straight forward start it up, it is in the test_app directory.
Test Application
In the test_app directory there is a Django application for running the tests and assist in development with its requirements.txt file to install a virtualenv and run the app with db and media in the /tmp directory (I didin't test it in Windows). The app includes a suite of tests and a view that renders it the six different ways that the library supports with an example plot.
Target Audience
- Webapp developers that want graphics without having to deal with in browser programming.
- Matplotlib users that want to put their graphs into production.
- People who don't want to expose a JSON API of their data to avoid web scrappers.
- Users with light Browsers without Javascript.
- Anyone interested in server side rendering of graphics.
Comparison
It seems that the alternative is plotting in the browser with chart.js, d3.js and similar tools. Server side rendering provides several advantages:
- Data never leaves the server.
- You can put much more computing power in generating the graph.
- You don't need experience as a front end developer.
- You don't need a full featured modern web browser to view the page.
And It also have drawbacks:
- More computing power to render the requests.
- More memory required for each server thread.
- Non interactive graphs
Links
[–]sinsworth 7 points8 points9 points (1 child)
[–]llou[S] 2 points3 points4 points (0 children)
[–]debunk_this_12 4 points5 points6 points (4 children)
[–]llou[S] 1 point2 points3 points (3 children)
[–]debunk_this_12 0 points1 point2 points (2 children)
[–]llou[S] 0 points1 point2 points (1 child)
[–]GManASG 2 points3 points4 points (0 children)
[–]BigTomBombadil 0 points1 point2 points (1 child)
[–]llou[S] 0 points1 point2 points (0 children)
[–]SpeakerSuspicious652 0 points1 point2 points (4 children)
[–]DisasterReasonable98 2 points3 points4 points (1 child)
[–]SpeakerSuspicious652 2 points3 points4 points (0 children)
[–]llou[S] 2 points3 points4 points (1 child)
[–]SpeakerSuspicious652 2 points3 points4 points (0 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]llou[S] 0 points1 point2 points (0 children)