Skip to content

Commit 170215f

Browse files
committed
[add] seaborn multiple plots
1 parent 5f72d90 commit 170215f

File tree

5 files changed

+276
-1
lines changed

5 files changed

+276
-1
lines changed

README.md

+42-1
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ All skills are base on the implementation of Python 3.
200200
<td><ul style="margin: 8px">
201201
<li><a href="#basic-seaborn">Basic (Seaborn)</li>
202202
<li><a href="#color-palette">Color Palette</li>
203+
<li><a href="#multiple-plots">Multiple Plots</li>
203204
</ul></td>
204205
</table>
205206

@@ -2264,9 +2265,49 @@ plt.title("Pastel2 Colormap (Qualitative)")
22642265

22652266
- [Details 🔥](seaborn/palette.ipynb)
22662267

2268+
## Multiple Plots
2269+
2270+
- [Details 🔥](seaborn/multiple_plots.ipynb)
2271+
2272+
### Using Matplotlib
2273+
``` py
2274+
data = sns.load_dataset("iris")
2275+
2276+
plt.figure(figsize=(11, 3))
2277+
plt.subplot(121)
2278+
sns.lineplot(x="sepal_length", y="sepal_width", data=data)
2279+
2280+
plt.subplot(122)
2281+
sns.lineplot(x="petal_length", y="petal_width", data=data)
2282+
```
2283+
2284+
![](assets/seaborn/subplot.jpg)
2285+
2286+
### Using Seaborn
2287+
2288+
#### FacetGrid
2289+
2290+
``` py
2291+
grid = sns.FacetGrid(data, col="species")
2292+
grid.map(plt.plot, "sepal_width")
2293+
```
2294+
2295+
![](assets/seaborn/facet_grid.jpg)
2296+
2297+
#### PairGrid
2298+
2299+
``` py
2300+
x_vars = ["sepal_length", "sepal_width", "petal_length", "petal_width"]
2301+
y_vars = ["species"]
2302+
2303+
grid = sns.PairGrid(data, x_vars=x_vars, y_vars=y_vars)
2304+
grid.map(sns.barplot)
2305+
```
2306+
2307+
![](assets/seaborn/pair_grid.jpg)
2308+
22672309
<!-- ##
22682310
2269-
## Multiple Axes
22702311
22712312
## Relational plots
22722313

assets/seaborn/facet_grid.jpg

37.6 KB
Loading

assets/seaborn/pair_grid.jpg

26.2 KB
Loading

assets/seaborn/subplot.jpg

34.9 KB
Loading

seaborn/multiple_plots.ipynb

+234
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)