Skip to content

Commit 96f0ad1

Browse files
authored
Merge pull request animator#766 from rishig2003/main
Added content for seaborn
2 parents ece668b + e4ec73b commit 96f0ad1

File tree

4 files changed

+83
-1
lines changed

4 files changed

+83
-1
lines changed
Loading

contrib/plotting-visualization/index.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@
44
- [Introducing Matplotlib](matplotlib-introduction.md)
55
- [Bar Plots in Matplotlib](matplotlib-bar-plots.md)
66
- [Pie Charts in Matplotlib](matplotlib-pie-charts.md)
7-
- [Line Charts in Matplotlib](matplotlib-line-plot.md)
7+
- [Line Charts in Matplotlib](matplotlib-line-plots.md)
8+
- [Introduction to Seaborn and Installation](seaborn-intro.md)
9+
- [Getting started with Seaborn](seaborn-basics.md)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
Seaborn helps you explore and understand your data. Its plotting functions operate on dataframes and arrays containing whole datasets and internally perform the necessary semantic mapping and statistical aggregation to produce informative plots. Its dataset-oriented, declarative API lets you focus on what the different elements of your plots mean, rather than on the details of how to draw them.
2+
3+
Here’s an example of what seaborn can do:
4+
```Python
5+
# Import seaborn
6+
import seaborn as sns
7+
8+
# Apply the default theme
9+
sns.set_theme()
10+
11+
# Load an example dataset
12+
tips = sns.load_dataset("tips")
13+
14+
# Create a visualization
15+
sns.relplot(
16+
data=tips,
17+
x="total_bill", y="tip", col="time",
18+
hue="smoker", style="smoker", size="size",
19+
)
20+
```
21+
Below is the output for the above code snippet:
22+
23+
![Seaborn intro image](images/seaborn-basics1.png)
24+
25+
```Python
26+
# Load an example dataset
27+
tips = sns.load_dataset("tips")
28+
```
29+
Most code in the docs will use the `load_dataset()` function to get quick access to an example dataset. There’s nothing special about these datasets: they are just pandas data frames, and we could have loaded them with `pandas.read_csv()` or build them by hand. Many users specify data using pandas data frames, but Seaborn is very flexible about the data structures that it accepts.
30+
31+
```Python
32+
# Create a visualization
33+
sns.relplot(
34+
data=tips,
35+
x="total_bill", y="tip", col="time",
36+
hue="smoker", style="smoker", size="size",
37+
)
38+
```
39+
This plot shows the relationship between five variables in the tips dataset using a single call to the seaborn function `relplot()`. Notice how only the names of the variables and their roles in the plot are provided. Unlike when using matplotlib directly, it wasn’t necessary to specify attributes of the plot elements in terms of the color values or marker codes. Behind the scenes, seaborn handled the translation from values in the dataframe to arguments that Matplotlib understands. This declarative approach lets you stay focused on the questions that you want to answer, rather than on the details of how to control matplotlib.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
Seaborn is a Python data visualization library based on Matplotlib. It provides a high-level interface for drawing attractive and informative statistical graphics.
2+
3+
## Seaborn Installation
4+
Before installing Matplotlib, ensure you have Python installed on your system. You can download and install Python from the [official Python website](https://www.python.org/).
5+
6+
Below are the steps to install and setup Seaborn:
7+
8+
1. Open your terminal or command prompt and run the following command to install Seaborn using `pip`:
9+
10+
```bash
11+
pip install seaborn
12+
```
13+
14+
2. The basic invocation of `pip` will install seaborn and, if necessary, its mandatory dependencies. It is possible to include optional dependencies that give access to a few advanced features:
15+
```bash
16+
pip install seaborn[stats]
17+
```
18+
19+
3. The library is also included as part of the Anaconda distribution, and it can be installed with `conda`:
20+
```bash
21+
conda install seaborn
22+
```
23+
24+
4. As the main Anaconda repository can be slow to add new releases, you may prefer using the conda-forge channel:
25+
```bash
26+
conda install seaborn -c conda-forge
27+
```
28+
29+
## Dependencies
30+
### Supported Python versions
31+
- Python 3.8+
32+
33+
### Mandatory Dependencies
34+
- [numpy](https://numpy.org/)
35+
- [pandas](https://pandas.pydata.org/)
36+
- [matplotlib](https://matplotlib.org/)
37+
38+
### Optional Dependencies
39+
- [statsmodels](https://www.statsmodels.org/stable/index.html) for advanced regression plots
40+
- [scipy](https://scipy.org/) for clustering matrices and some advanced options
41+
- [fastcluster](https://pypi.org/project/fastcluster/) for faster clustering of large matrices

0 commit comments

Comments
 (0)