In this Plotly tutorial, you will learn how to change the background color of a plot.
# Import Plotly Module import plotly.express as px # Import Dataset dataset = px.data.gapminder().query("continent=='Oceania'") # Background Color plot = px.scatter(dataset, x="gdpPercap", y="lifeExp", color='country', title='Life Expectancy vs GDP per Capita', height=400, width=800, template='plotly_dark') # Show the Plot plot.show()
Output:
