Skip to content

Commit 4eecbe7

Browse files
facet plot done
1 parent 246f582 commit 4eecbe7

File tree

1 file changed

+4
-8
lines changed
  • 3-Data-Visualization/R/12-visualization-relationships

1 file changed

+4
-8
lines changed

3-Data-Visualization/R/12-visualization-relationships/README.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,15 +119,11 @@ To discover this, you can explore a facet grid.
119119

120120
Facet grids take one facet of your dataset (in our case, you can choose 'year' to avoid having too many facets produced). Seaborn can then make a plot for each of those facets of your chosen x and y coordinates for more easy visual comparison. Does 2003 stand out in this type of comparison?
121121

122-
Create a facet grid by continuing to use `relplot` as recommended by [Seaborn's documentation](https://seaborn.pydata.org/generated/seaborn.FacetGrid.html?highlight=facetgrid#seaborn.FacetGrid).
122+
Create a facet grid by using `facet_wrap` as recommended by [ggplot2's documentation](https://ggplot2.tidyverse.org/reference/facet_wrap.html).
123123

124-
```python
125-
sns.relplot(
126-
data=honey,
127-
x="yieldpercol", y="numcol",
128-
col="year",
129-
col_wrap=3,
130-
kind="line"
124+
```r
125+
ggplot(honey, aes(x=yieldpercol, y = numcol,group = 1)) +
126+
geom_line() + facet_wrap(vars(year))
131127
```
132128
In this visualization, you can compare the yield per colony and number of colonies year over year, side by side with a wrap set at 3 for the columns:
133129

0 commit comments

Comments
 (0)