0% found this document useful (0 votes)
9 views3 pages

7 Apr

The document provides instructions for installing and using the Seaborn library in Python, indicating that the library is already installed along with its dependencies. It includes code examples for creating line plots using a custom dataset and the 'penguins' dataset, as well as a bar plot using the 'tips' dataset. The document emphasizes the visualization of data with various attributes and settings in Seaborn.

Uploaded by

Swappy Maskey
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views3 pages

7 Apr

The document provides instructions for installing and using the Seaborn library in Python, indicating that the library is already installed along with its dependencies. It includes code examples for creating line plots using a custom dataset and the 'penguins' dataset, as well as a bar plot using the 'tips' dataset. The document emphasizes the visualization of data with various attributes and settings in Seaborn.

Uploaded by

Swappy Maskey
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

# Seanborn

pip install seaborn

Requirement already satisfied: seaborn in /opt/anaconda3/lib/python3.12/site-packages (0.13.2)


Requirement already satisfied: numpy!=1.24.0,>=1.20 in /opt/anaconda3/lib/python3.12/site-packages (from seaborn
) (1.26.4)
Requirement already satisfied: pandas>=1.2 in /opt/anaconda3/lib/python3.12/site-packages (from seaborn) (2.2.2)
Requirement already satisfied: matplotlib!=3.6.1,>=3.4 in /opt/anaconda3/lib/python3.12/site-packages (from seab
orn) (3.9.2)
Requirement already satisfied: contourpy>=1.0.1 in /opt/anaconda3/lib/python3.12/site-packages (from matplotlib!
=3.6.1,>=3.4->seaborn) (1.2.0)
Requirement already satisfied: cycler>=0.10 in /opt/anaconda3/lib/python3.12/site-packages (from matplotlib!=3.6
.1,>=3.4->seaborn) (0.11.0)
Requirement already satisfied: fonttools>=4.22.0 in /opt/anaconda3/lib/python3.12/site-packages (from matplotlib
!=3.6.1,>=3.4->seaborn) (4.51.0)
Requirement already satisfied: kiwisolver>=1.3.1 in /opt/anaconda3/lib/python3.12/site-packages (from matplotlib
!=3.6.1,>=3.4->seaborn) (1.4.4)
Requirement already satisfied: packaging>=20.0 in /opt/anaconda3/lib/python3.12/site-packages (from matplotlib!=
3.6.1,>=3.4->seaborn) (24.1)
Requirement already satisfied: pillow>=8 in /opt/anaconda3/lib/python3.12/site-packages (from matplotlib!=3.6.1,
>=3.4->seaborn) (10.4.0)
Requirement already satisfied: pyparsing>=2.3.1 in /opt/anaconda3/lib/python3.12/site-packages (from matplotlib!
=3.6.1,>=3.4->seaborn) (3.1.2)
Requirement already satisfied: python-dateutil>=2.7 in /opt/anaconda3/lib/python3.12/site-packages (from matplot
lib!=3.6.1,>=3.4->seaborn) (2.9.0.post0)
Requirement already satisfied: pytz>=2020.1 in /opt/anaconda3/lib/python3.12/site-packages (from pandas>=1.2->se
aborn) (2024.1)
Requirement already satisfied: tzdata>=2022.7 in /opt/anaconda3/lib/python3.12/site-packages (from pandas>=1.2->
seaborn) (2023.3)
Requirement already satisfied: six>=1.5 in /opt/anaconda3/lib/python3.12/site-packages (from python-dateutil>=2.
7->matplotlib!=3.6.1,>=3.4->seaborn) (1.16.0)
Note: you may need to restart the kernel to use updated packages.

import matplotlib.pyplot as plt


import pandas as pd
import seaborn as sns

var = [1,2,3,4,5,6,7,8]
var_1 = [10,13,21,15,35,42,37,24]

x_1 = pd.DataFrame({"var":var, "var_1":var_1})


sns.lineplot(x="var", y="var_1",data=x_1)

plt.show()

y_1 = sns.load_dataset("penguins")
y_1
species island bill_length_mm bill_depth_mm flipper_length_mm body_mass_g sex

0 Adelie Torgersen 39.1 18.7 181.0 3750.0 Male

1 Adelie Torgersen 39.5 17.4 186.0 3800.0 Female

2 Adelie Torgersen 40.3 18.0 195.0 3250.0 Female

3 Adelie Torgersen NaN NaN NaN NaN NaN

4 Adelie Torgersen 36.7 19.3 193.0 3450.0 Female

... ... ... ... ... ... ... ...

339 Gentoo Biscoe NaN NaN NaN NaN NaN

340 Gentoo Biscoe 46.8 14.3 215.0 4850.0 Female

341 Gentoo Biscoe 50.4 15.7 222.0 5750.0 Male

342 Gentoo Biscoe 45.2 14.8 212.0 5200.0 Female

343 Gentoo Biscoe 49.9 16.1 213.0 5400.0 Male

344 rows × 7 columns

sns.lineplot(x="bill_length_mm", y="bill_depth_mm",data=y_1,hue='sex')

plt.title("penguins",fontsize=15)
plt.show()

import seaborn as sns


import matplotlib.pyplot as plt

tips = sns.load_dataset("tips")
sns.set_theme(style="whitegrid")

plt.figure(figsize=(6, 4))
sns.barplot(x="day", y="total_bill", hue="day", data=tips, palette="gray", legend=False)
sns.despine()

plt.xlabel("Day of the Week", fontsize=12)


plt.ylabel("Average Total Bill", fontsize=12)
plt.title("Average Total Bill by Day", fontsize=14)

plt.tight_layout()
plt.show()
Loading [MathJax]/jax/output/CommonHTML/fonts/TeX/fontdata.js

You might also like