Plotly 3D scatter plot with color scaling

In this Plotly tutorial, you will learn how to plot 3D scatter plot with color scaling in Python. You can use the following code for this task.

# Import Plotly Module
import plotly.express as px

# Import Dataset
dataset = px.data.gapminder().query("continent=='Oceania'")

# 3D Scatter Plot with Color Scaling
plot = px.scatter_3d(dataset, x="gdpPercap", y="lifeExp", z="pop", color="pop")

# Show the Plot
plot.show()

Output:

Plotly 3D scatter plot with color scaling

Free learning resources: AiHintsCodeAllow

Leave a Comment

Your email address will not be published.