0

I used the following code to do plot a figure in python, but it does return anything at all. Does anyboday know why this happend? And how can I fix it? Thank you.

import plotly.express as px
df = px.data.iris()
fig = px.scatter(df, x="sepal_width", y="sepal_length", color="species")
fig.show() 
2
  • what error does it throw? Commented Jul 22, 2020 at 10:13
  • It does return any error at all. Commented Jul 23, 2020 at 2:44

1 Answer 1

1

If you're running this in a Jupyter Notebook, then you need to install the extensions.

See the following from the repo's readme:

Jupyter Notebook Support

For use in the Jupyter Notebook, install the notebook and ipywidgets packages using pip...

pip install "notebook>=5.3" "ipywidgets==7.5"

or conda.

conda install "notebook>=5.3" "ipywidgets=7.5"

JupyterLab Support (Python 3.5+)

For use in JupyterLab, install the jupyterlab and ipywidgets packages using pip...

pip install jupyterlab "ipywidgets==7.5"

or conda.

conda install jupyterlab "ipywidgets=7.5"

Then run the following commands to install the required JupyterLab extensions (note that this will require node to be installed):

# Basic JupyterLab renderer support
jupyter labextension install [email protected]

# OPTIONAL: Jupyter widgets extension for FigureWidget support
jupyter labextension install @jupyter-widgets/jupyterlab-manager [email protected]

Please check out our Troubleshooting guide if you run into any problems with JupyterLab.

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

2 Comments

Thank you very much for your answer! It works well. I truly appreciate your help.
happy to help, Amy - remember that you can accept an answer if you find it useful

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.