I’ve been learning how to use plotly in the Jupyter notebook but prefer working in Spyder. Where can I find resources on how to run Plotly from Spyder?
I just got it up and running on spyder 3.0 using the following steps. (windows 10)
- Download plotly using pip usig command line (python -m pip install plotly) this requires downloading python 3.5 separately from Spyder as well. (so far I haven’t had any conflicts)
- In Spyder, goto->Tools ->PYTHONPATH Manager -> addPath -> insert path to Plotly library (mine was in python\python36-32\Lib\site-packages), then synchronize
- Restart Spyder
- test it out with import plotly.plotly \n import plotly.graph_objs as go in a new .py scrypt
Hope it works out for you.
I follow the process and spyder and anaconda stop working.
To use plotly.py from Spyder, here’s what I would recommend:
- Download and install the anaconda Python distribution: https://www.anaconda.com/download/
- Install both Spyder and plotly.py using conda.
$ conda install -c plotly plotly spyder
- Create plots from spyder using the
plotly.offline.plot(offline) functions. Each of these will open the plots in your default web browser.
- If you want static image export support, install the
psutilpackages (See https://github.com/plotly/plotly.py#static-image-export)
$ conda install -c plotly plotly-orca psutil
I am still unable to run suggested solution provided by “jmmease”.
Any help would be appreicated in showing step by step on how to get the graphs to run in Spyder Anaconda or have the graphs show in a browser by running the code in “spyder”
After you’ve installed the
plotly package, try running this code from spyder
from plotly.offline import plot import plotly.graph_objs as go fig = go.Figure(data=[go.Bar(y=[1, 3, 2])]) plot(fig, auto_open=True)
This should open up a bar chart in a new tab of your default browser.
Hope that helps!
I am using spyder and I followed your instructions.
in my terminal
conda install -c plotly plotly spyder
conda install -c plotly plotly-orca psutil
I imported the graph objects as follows
from plotly.offline import plot
import plotly.graph_objs as go
I get the following error when I try this code
fig = go.Figure([go.Scatter(x=combined[‘Date’], y=combined[‘confirmed’])])
TypeError: super(type, obj): obj must be an instance or subtype of type
Do you have any suggestions?