• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Data Viz with Python and R

Learn to Make Plots in Python and R

  • Home
  • Python Viz
  • Seaborn
  • Altair
  • R Viz
  • ggplot2
  • About
    • Privacy Policy
  • Show Search
Hide Search

How to Make Grouped Violinplot with Seaborn in Python?

datavizpyr · July 3, 2020 ·

In this tutorial, we will learn how to make group violinplots with Seaborn in Python. In Seaborn, we have atleast two ways to make violinplots using Seaborn in Pyhon. First is to use violinplot() function and make violinplot. And the second option is to use Seaborn’s catplot() function. In this post, we will start with making a simple violinplot first and use both violinplot() function and catplot() function to learn to make grouped violinplot.

Let us load the libraries needed.

import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
penguins_data="https://raw.githubusercontent.com/datavizpyr/data/master/palmer_penguin_species.tsv"
penguins_df = pd.read_csv(penguins_data, sep="\t")
penguins_df.head()
plt.figure(figsize=(8,6))
sns.violinplot(y="flipper_length_mm", 
                x="species", 
                data=penguins_df)
plt.savefig("violinplot_Seaborn_Python.png",
                    format='png',
                    dpi=150)
Violinplot Seaborn Pyhton
Violinplot Seaborn Pyhton

Grouped Violinplot with Seaborn violinplot()

plt.figure(figsize=(8,6))
sns.violinplot(y="flipper_length_mm", 
                x="species", 
                #hue="species",
                hue="sex",
                data=penguins_df)
plt.savefig("grouped_violinplot_with_Seaborn_violinplot.png",
                    format='png',dpi=150)

Grouped Violinplot with Seaborn violinplot()
Grouped Violinplot with Seaborn violinplot()

Grouped Violinplot with Seaborn Catplot

sns.catplot(y="flipper_length_mm", 
                x="species", 
                hue="sex",
                kind="violin",
                data=penguins_df, 
                height=8)
plt.savefig("grouped_violinplot_with_Seaborn_catplot.png",
                    format='png',
                    dpi=150)
Grouped Violinplot with Seaborn Catplot
Grouped Violinplot with Seaborn Catplot

Related posts:

Seaborn Violinplot with Data Points Using SwarmplotHow To Make Violinpot with data points in Seaborn? Horizontal Violin Plot with Catplot SeabornHow to Make Horizontal Violin Plot with Seaborn in Python? Grouped Boxplot in Python with SeabornGrouped Boxplots in Python with Seaborn Sort bars in barplot descending order with Seaborn PythonHow To Order Bars in Barplot using Seaborn in Python?

Filed Under: Grouped Violinplot, Python, Seaborn Violin Plot Tagged With: Pyhon, Seaborn, Violinplot

Primary Sidebar

Tags

Altair barplot Boxplot boxplot python boxplot with jiitered text labels Bubble Plot Color Palette Countplot Density Plot Facet Plot gganimate ggplot2 ggplot2 Boxplot ggplot2 error ggplot boxplot ggridges ggtext element_markdown() Grouped Barplot R heatmap heatmaps Histogram Histograms Horizontal boxplot Python lollipop plot Maps Matplotlib Pandas patchwork pheatmap Pyhon Python R RColorBrewer reorder boxplot ggplot Ridgeline plot Scatter Plot Scatter Plot Altair Seaborn Seaborn Boxplot Stock Price Over Time Stripplot UpSetR Violinplot Violin Plot World Map ggplot2

Buy Me a Coffee

Copyright © 2025 · Daily Dish Pro on Genesis Framework · WordPress · Log in

Go to mobile version