Plotly Violin Plot

In this Plotly tutorial, you will learn how to plot a violin plot in Python. You can use px.violin() function to plot a violin plot.

# Import Plotly Module
import plotly.express as px

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

# Violin Plot
plot = px.violin(dataset, y="lifeExp", color='country', title='Plotly Violin Plot', height=400, width=600)

# Show the Plot
plot.show()

Output:

Plotly Violin Plot

Free learning resources: AiHintsCodeAllow

Leave a Comment

Your email address will not be published.