Reputation: 131
I am working on generating some plots using python, but I am generating these plots using matplotlib which is saved as images. If I create an html page as a report with these plots, they are static images. I cannot zoom in or roll over on the plot to see more detailed or specific information on a time series plot.
My question is how can I make these plots dynamic? Can someone suggest the best way to get started and move forward from there?
Upvotes: 1
Views: 973
Reputation: 1125
You should use some additional libraries to achive your goal.
For example, there some good Python web frameworks wich you can use:
I would suggest Plotly, because it is much simpler, but it depends on your needs.
Upvotes: 1
Reputation: 3297
You will definitely want to do it using javascript
. It's by far your best option when it comes to quickly make interactive graphs that you can present to a lot of users. Any of these js
libraries will do a great job.
You will then want python
to provide the data. Depending on the js
library you are using, you might be able to parse data from .json
, .csv
, etc...
If you don't need the data that makes up your plots to change (with user input, for example), then generating and saving flat files with python
and having javascript
parsing them from some directory might be just enough.
Otherwise, you want to take a look at a python web framework and use one as backend to serve the plots data by request (in that case .json
is probably the right format).
Frameworks like Flask
, CherryPy
, Pyramid
or even web2py
might be the easier ones to start with.
Upvotes: 0