Forums

plotting or ipython notebook

Is there a preferred best way to see charts in pythonanywhere. If I am using matplotlib inside ipython. How do you see charts in ipython in pythonanywhere or can I go start an ipython notebook and then see a chart in an outside gui?

I have tried both ways (plot inside ipython, ipython notebook) and they didn't seem to work, with the ipython notebook I was using port 8888.

IPython notebook on PA is something we really want to do and many of our users also want it. There is a significant amount of work that we need to do to make it work on PA.

In the meantime, you can draw your graphs to a .png in your home directory and then use the Files feature on PA to view it in your browser. You'd have to reload it every time you changed it. I've used this and it's not as easy as IPython Notebook, but it's pretty useable once you get going.

For standard charts, I like to use Google Charts on a web page, but it depends whether that's a convenient way for you to present your data (and whether it works for your chosen chart, since matplotlib is considerably more flexible).

Still, I've also used matplotlib to generate PNGs and, while it's slightly fiddly to tweak it to generate precise output resolutions and so on, it's not too difficult to get going. I've also used it to generate images on-the-fly in a webserver instead of saving them to files - I found this FAQ entry quite useful for that (executive summary: use a StringIO as an output file then pass that to PIL).