简体   繁体   中英

Python Plotly not showing 3d interactive plot

I am using Spyder ide. I have plotly 5.5.0 installed on my pc. The following executes with no errors but does not show/popup the 3d interactive plot. Code:

import plotly.express as px
df = px.data.iris()
fig = px.scatter_3d(df, x='sepal_length', y='sepal_width', z='petal_width',
              color='species')
fig.show()

To be able to interact with the figure running from Spyder you will need to call show with the 'browser' renderer (this will show the figure on your default browser). The code provided with this change will look something like this:

import plotly.express as px
df = px.data.iris()
fig = px.scatter_3d(df, x='sepal_length', y='sepal_width', z='petal_width',
              color='species')
fig.show(renderer='browser')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM