Plotly figures not showing up on github-hosted site? - python

I'm having some trouble with Plotly (Python) figures not being rendered on my github-hosted website (here: https://degravek.github.io/project-pages/). In order to make the posts on that site, I have to upload a .ipynb file. When I do this, though, the Plotly figures do not show up for some reason. Some googling doesn't seem to shed much light on the problem. Other figures plotted using seaborn or pandas show up just fine though. Anyone else have this problem and know how to solve it?

Related

Issues with too many interactive plotly figures

I am using Jupyter notebook on my laptop (the version coming with Anaconda) to perform some sensitivity analysis.
I use plotly to display the results and I like the interactive features that it has.
However, when I am trying to display more than 7/8 interactive plots on the same notebook, some plots disappears and the output cells of those plots go crazy (see picture attached).
Issue with plotly
A solution I found was to disable the interactive feature at least for some of the plots, changing the diplay mode in config as:
config = {'staticPlot': True}
fig.show(config=config)
This method works, however, I like the feature and I was wondering if there was a solution that does not imply disabling the interactive view.
I read about this post where they say it might be a memory issue (even though their graphs are going blank while mine are behaving crazy):
Plotly: How to prevent graphs from going blank when there are too many interactive plots?
However I did not manage to find/change the jupyter configuration file, maybe because I installed it via Anaconda?
I was also wondering if someone experienced exactly the same or there might be a simpler solution to this issue.
Thanks a lot in advance
I believe that in the second link the config file should be generated if not existing.
You can also try changing to gl rendering:
https://plotly.com/python/webgl-vs-svg/

Figure is not properly displayed whiile using %matplotlib notebook in Jupyter Notebook

As you can see on the image posted below, for some reason the notebook doesn't want to properly display a figure while using the interactive matplotlib interface - the %matplotlib notebook and it only prints the top left corner of the wanted plot. I've browsed the Internet, mostly this forum but I haven't found solution either, so I've got no other choice than to make a post about it.
If I switch it back to classic %matplotlib inline, I've got no issues and the figure is displayed correctly. I'd really appreciate any help you can offer, it drives me crazy because I need to properly display these interactive plots, in order to learn from other notebooks which use them. So I'm not searching for any other alternatives to using interactive figures, but I'd preferably want this particular issue to be resolved.
Thank you.
This was rather a quick solution to my suprise. I was even thinking of pulling this question off the site, since I resolved this quite promptly, but then again you never know, someone might end up with the very same problem as I encountered before.
So anyway, changing the browser does the trick. At least in my case changing from Chrome to Firefox solved this issue of mine.

Use Matplotlib on django site

I am thinking of starting a new django project for plotting stock prices and displaying them onto the site. I know matplotlib pretty well and was wondering if I could plot the chart and somehow push it to the site with the usual matplotlib features like zoom etc.
I have seen this done where that images are pushed but I am wondering if I could push the chart with its functionality provided by matplotlib and I can't seem to find an answer anywhere so maybe it isn't possible?
I've never used it personally, but mpld3 appears to do what you are asking.

How to show number of indents with little arrows in Jupyter Notebook?

I remember that I saw some code from the web that has little arrows in front of each line to identify its number of indents, which turned out to be very helpful when the code is long. But I can't find that web page anymore so I wonder if anyone knows how to add that kind of indicator in Jupyter Notebook? Thanks!

Embed interactive matplotlib plot in a webpage

I have a simple matplotlib scatter plot which uses this code
to display an annotation when points are clicked on. I need to embed this in a webpage. How should I do this?
I found similar questions here as well but couldn't quite understand the answers. If someone could explain it a bit clearly in detail please?
Edit: I need to do something like this, with the interactive scatter plot being displayed in the webpage. However, on looking at the source code of the webpage, it did not look like the python code is being called.
How do I do something similar?
I don't think you'll be able to use the same code that you used before in a webpage, but using a library like bokeh and the hover tool would make it fairly easy to get a similar behaviour
http://docs.bokeh.org/en/latest/docs/user_guide/tools.html#hovertool

Categories