1

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?

2 Answers 2

1

You should use some additional libraries to achive your goal.
For example, there some good Python web frameworks wich you can use:

  • CherryPy - allows you to simply write web-app with Python and you can import your plot there.
  • Plotly Python API - it would simply generate interactive plot, but store it at Plotly platform, but they provide embeded-code option, so you can use it on your site.

I would suggest Plotly, because it is much simpler, but it depends on your needs.

Sign up to request clarification or add additional context in comments.

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.