I'm creating an interactive plot using Pywedge Bibliothek in jupyter notebook using this code
x=pw.Pywedge_Charts(df, c=None, y='Number_Trips')
charts=x.make_charts()
charts
an example of the output is as follows
and i can desactivate as well as activate the day i want to see.. my question is how can i save it and keep it interactive to use it in a website or if it is even possible?
The way to save interactivity is to save the source of df and the code to generate the plot. To open an interactive plot, run the script that generates it.
Related
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/
I would like to delete all the plots in the plot pane with some code so I can automatically "clear" the interface. I am aware there is a button you can click that deletes them all. However, I would like to avoid having to click manually on the plot pane to delete all the plots generated in the previous runs.
Right now I am already clearing the console and the variable explorer by using (which I got from link):
try:
from IPython import get_ipython
get_ipython().magic('clear')
get_ipython().magic('reset -f')
except:
pass
Now I would like to add there something that also clears the plot pane.
(Spyder maintainer here) It is not possible to remove all plots from the Plots pane using code, sorry.
With the bokeh package, I created a graph visualization and with show(plot) the output is shown in Jupyter but also at the same time a new tab in the browser is opened with the output. I only want to plot it in a Jupyter cell without opening the plot as a new html file. Is this somehow possible?
#Booketh plot
output_file("thisisaplot.html")
show(plot)
According to the documentation, you should be able to do that by calling output_notebook() before calling show().
Note: As pointed out by #bigreddot, if you were using output_file in the kernel, changing to output_notebook may not take place right away. You will need to either call reset_output(), or restart your kernel for the change to take place.
I've been using the IEP from pyzo before trying out Sublime Text (ST).
There is an annoying behaviour with ST that IEP doesn't have.
In IEP, much like with Matlab or Octave, the editor and the interactive console talk to each other.
Typically if you compute some_stuff and plot it in a script, after execution of this script you can go to the console and check some values:
print some_stuff[0:10]
or modify your plot:
plt.whatever()
which will update your figure.
Also if you run your script several times with different parameters, the figure is simply updated.
However when you do so in ST, even with REPL, after execution of the script nothing is left, you can't access some_stuff[0:10] from REPL. Similarly, you can't modify your figure. And if you run your script several times with different parameters, a new figure is generated in a new window each time instead of updating the existing figure.
Is there an easy work around this? Thanks!
How about saving your figure to a file with plt.savefig("fig.png")? If you open that file with your image viewer it will be updated after running your program.
I"m running into issues when trying to interactively make plots with matplotlib.pyplot.
The general sequence of events is as follows:
1) open terminal, type ipython, copy and paste commands from my sublime text into ipython, eventually typing plt.show().
2) viewing my nice pretty plot be made, but with one small issue I want to fix or build upon
3) closing the window that houses the plot
4) seeing the command line return to normal again. Typing plt.close(), just to make sure the plot really closed
5) copying and pasting commands again, again ending with plt.show().
Only, the result of #5 results in no plot this time!
This seems to be a problem that repeats itself, so if anyone has any input I'd be very grateful. I noticed that when I create the plot the first time, it creates a plot window (which I can see with Command-Tab Application Switcher). When I try to close this after making the plot the first time, this window never actually disappears from the Application Switcher.
Thanks