Skip to content

Instantly share code, notes, and snippets.

@Priyanku-AI
Created December 6, 2023 17:46
Show Gist options
  • Save Priyanku-AI/5ca68627e66f395ccdbaecf2bd634ae2 to your computer and use it in GitHub Desktop.
Save Priyanku-AI/5ca68627e66f395ccdbaecf2bd634ae2 to your computer and use it in GitHub Desktop.
How to create a Box plot?
import seaborn as sns
import matplotlib.pyplot as plt
# Example Data (randomly generated)
data = sns.load_dataset("tips")
# Creating the Box Plot
sns.boxplot(x="day", y="total_bill", data=data, palette="Set2")
# Create a box plot of total bill amounts grouped by day, using the 'Set2' color palette
# Adding Labels
plt.title('Box Plot of Total Bills by Day')
plt.xlabel('Day')
plt.ylabel('Total Bill Amount')
# Displaying the Plot
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment