In this Plotly tutorial, you will learn how to plot a marginal plot in Python. You have to use the marginal_x
and marginal_y
parameters for a marginal plot.
# Import Plotly Module import plotly.express as px # Import Dataset dataset = px.data.gapminder().query("continent=='Oceania'") # Marginal Plot plot = px.scatter(dataset, x="gdpPercap", y="lifeExp", marginal_x="histogram", marginal_y="rug") # Show the Plot plot.show()
Output:
