Get Datasets Name:
import seaborn as sns
import matplotlib.pyplot as plt
sns.get_dataset_names()
#load specific dataset:
sns.load_dataset('attention')
#store in variable
data=sns.load_dataset('exercise')
print(data)
import matplotlib.pyplot as plt
df = sns.load_dataset('iris')
# print(df.head())
a=df.head() #get first five row by default
print(a["sepal_width"])
sns.boxplot( y=a["sepal_length"] );
plt.show()
Program 2:
import Seaborn as sns
import matplotlib.pyplot as plt
df = sns.load_dataset('exercise')
df.head()
sns.boxplot( y=df["time"], x=df["pulse"] );
plt.show()
OUTPUT:
OUTPUT:
Program:
df = sns.load_dataset('exercise') '//load data from seaborn dataset
df.head() //select first 5 row
graph=sns.boxplot( y=df["time"], x=df["pulse"] ); //plot graph giving x axis=time
graph.axes.set_title("My Graph",
fontsize=16) //give graph title
graph.set_xlabel("Marks",
fontsize=14)
graph.set_ylabel("Age",
fontsize=14)
graph.figure.savefig("box.jpg",
format='jpeg', // save graph
dpi=100)
How to draw stripplot() graph:
df = sns.load_dataset('attention')
df.head()
graph=sns.boxplot( y=df["score"], x=df["subject"] );
sns.stripplot(y=df["score"], x=df["subject"])
OUTPUT:
Swarplot() graph:
df = sns.load_dataset('exercise')
df.head()
graph=sns.boxplot( y=df["time"], x=df["pulse"] );
sns.swarmplot(y=df['time'], x=df['pulse'])
OUTPUT:
import seaborn as sns
import matplotlib.pyplot as plt
sns.get_dataset_names()
#load specific dataset:
sns.load_dataset('attention')
#store in variable
data=sns.load_dataset('exercise')
print(data)
Program:
import seaborn as snsimport matplotlib.pyplot as plt
df = sns.load_dataset('iris')
# print(df.head())
a=df.head() #get first five row by default
print(a["sepal_width"])
sns.boxplot( y=a["sepal_length"] );
plt.show()
OUTPUT:
Program 2:
import Seaborn as sns
import matplotlib.pyplot as plt
df = sns.load_dataset('exercise')
df.head()
sns.boxplot( y=df["time"], x=df["pulse"] );
plt.show()
OUTPUT:
Create Boxplot from dataframe data:
import seaborn as sns
import pandas as p
import matplotlib.pyplot as plt
# df = sns.load_dataset('exercise')
# df.head()
a=p.DataFrame({"a":[10,33,44,58,44],"b":[93,44,96,66,69]})
sns.boxplot( y=a["a"], x=a["b"] );
plt.show()
OUTPUT:
Program:
df = sns.load_dataset('exercise') '//load data from seaborn dataset
df.head() //select first 5 row
graph=sns.boxplot( y=df["time"], x=df["pulse"] ); //plot graph giving x axis=time
graph.axes.set_title("My Graph",
fontsize=16) //give graph title
graph.set_xlabel("Marks",
fontsize=14)
graph.set_ylabel("Age",
fontsize=14)
graph.figure.savefig("box.jpg",
format='jpeg', // save graph
dpi=100)
How to draw stripplot() graph:
df = sns.load_dataset('attention')
df.head()
graph=sns.boxplot( y=df["score"], x=df["subject"] );
sns.stripplot(y=df["score"], x=df["subject"])
OUTPUT:
Swarplot() graph:
df = sns.load_dataset('exercise')
df.head()
graph=sns.boxplot( y=df["time"], x=df["pulse"] );
sns.swarmplot(y=df['time'], x=df['pulse'])
OUTPUT: