0% found this document useful (0 votes)
12 views5 pages

Seaborn: Key Features

Seaborn is a user-friendly Python library for creating statistical graphics, built on Matplotlib, which simplifies data visualization. It offers features like ease of use, built-in themes, and integration with pandas and NumPy, along with various plot types for univariate and bivariate data analysis. Examples include histograms, KDE plots, scatter plots, and pair plots, each demonstrating different aspects of data distribution and relationships.

Uploaded by

viki49609
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)
12 views5 pages

Seaborn: Key Features

Seaborn is a user-friendly Python library for creating statistical graphics, built on Matplotlib, which simplifies data visualization. It offers features like ease of use, built-in themes, and integration with pandas and NumPy, along with various plot types for univariate and bivariate data analysis. Examples include histograms, KDE plots, scatter plots, and pair plots, each demonstrating different aspects of data distribution and relationships.

Uploaded by

viki49609
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/ 5

Seaborn

Seaborn is a powerful and user-friendly Python library built on top of Matplotlib. It simplifies the
process of creating attractive and informative statistical graphics, making it an excellent choice for
data visualization.

Key Features:

1. Ease of use: Simple syntax to create complex visualizations.


2. Built-in themes: Customizable themes for styling plots.
3. Statistical plotting: Built-in methods for regression, box plots, violin plots, etc.
4. Integration: Works seamlessly with pandas DataFrames and NumPy arrays.

Types:

Univariate Plots

These plots display the distribution of a single variable.

1. Histogram

Shows the frequency distribution of a variable.

Example:

import seaborn as sns

import matplotlib.pyplot as plt

import numpy as np

# Generate random data

data = np.random.randn(1000)

# Create a histogram

sns.histplot(data, bins=30, color="blue")

plt.title("Univariate Plot - Histogram")

plt.xlabel("Value")

plt.ylabel("Frequency")

plt.show()

2. KDE Plot (Kernel Density Estimate)


Displays the probability density function of a variable.

Example:

sns.kdeplot(data, shade=True, color="red")

plt.title("Univariate Plot - KDE")

plt.xlabel("Value")

plt.ylabel("Density")

plt.show()

3. Box Plot

Summarizes data distribution using median, quartiles, and outliers.

Example:

sns.boxplot(x=data, color="cyan")

plt.title("Univariate Plot - Box Plot")

plt.xlabel("Value")

plt.show()

4. Violin Plot

Combines KDE and box plot to show distribution and density.

Example:

sns.violinplot(x=data, color="purple")

plt.title("Univariate Plot - Violin Plot")

plt.xlabel("Value")

plt.show()

Bivariate Plots

These plots explore the relationship between two variables.

1. Scatter Plot
Visualizes the relationship between two continuous variables.

Example:

x = np.random.rand(100)

y = np.random.rand(100)

sns.scatterplot(x=x, y=y, color="green")

plt.title("Bivariate Plot - Scatter Plot")

plt.xlabel("X-axis")

plt.ylabel("Y-axis")

plt.show()

2. Line Plot

Shows trends or changes between two variables over time or sequence.

Example:

x = np.linspace(0, 10, 100)

y = np.sin(x)

sns.lineplot(x=x, y=y, color="blue")

plt.title("Bivariate Plot - Line Plot")

plt.xlabel("X-axis")

plt.ylabel("Y-axis")

plt.show()

3. Heatmap

Displays a matrix of values using color intensity to indicate magnitude.

Example:

data = np.random.rand(10, 10)

sns.heatmap(data, annot=True, cmap="coolwarm")

plt.title("Bivariate Plot - Heatmap")


plt.show()

4. Bar Plot

Compares categorical and numerical variables.

Example:

categories = ["A", "B", "C"]

values = [10, 20, 15]

sns.barplot(x=categories, y=values, palette="muted")

plt.title("Bivariate Plot - Bar Plot")

plt.xlabel("Categories")

plt.ylabel("Values")

plt.show()

5. Pair Plot:(Special Bivariate Plot)

Plots all possible pairwise scatter plots of numerical variables.

Example:

import pandas as pd

data = pd.DataFrame({

"X": np.random.rand(50),

"Y": np.random.rand(50),

"Z": np.random.rand(50)

})

sns.pairplot(data)

plt.suptitle("Bivariate Plot - Pair Plot", y=1.02)

plt.show()

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy