Skip to content

Commit 2cdacb8

Browse files
scatter plot 1 done
1 parent 1aae044 commit 2cdacb8

File tree

1 file changed

+7
-5
lines changed
  • 3-Data-Visualization/R/12-visualization-relationships

1 file changed

+7
-5
lines changed

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Visualizing Relationships: All About Honey 🍯
22

3-
|![ Sketchnote by [(@sketchthedocs)](https://sketchthedocs.dev) ](../../sketchnotes/12-Visualizing-Relationships.png)|
3+
|![ Sketchnote by [(@sketchthedocs)](https://sketchthedocs.dev) ](../../../sketchnotes/12-Visualizing-Relationships.png)|
44
|:---:|
55
|Visualizing Relationships - _Sketchnote by [@nitya](https://twitter.com/nitya)_ |
66

@@ -12,11 +12,11 @@ It will be interesting to visualize the relationship between a given state's pro
1212

1313
## [Pre-lecture quiz](https://red-water-0103e7a0f.azurestaticapps.net/quiz/22)
1414

15-
In this lesson, you can use Seaborn, which you have used before, as a good library to visualize relationships between variables. Particularly interesting is the use of Seaborn's `relplot` function that allows scatter plots and line plots to quickly visualize '[statistical relationships](https://seaborn.pydata.org/tutorial/relational.html?highlight=relationships)', which allow the data scientist to better understand how variables relate to each other.
15+
In this lesson, you can use Seaborn, which you have used before, as a good library to visualize relationships between variables. Particularly interesting is the use of ggplot2's `ggplot`and `geom_point` function that allows scatter plots and line plots to quickly visualize '[statistical relationships](https://ggplot2.tidyverse.org/)', which allow the data scientist to better understand how variables relate to each other.
1616

1717
## Scatterplots
1818

19-
Use a scatterplot to show how the price of honey has evolved, year over year, per state. Seaborn, using `relplot`, conveniently groups the state data and displays data points for both categorical and numeric data.
19+
Use a scatterplot to show how the price of honey has evolved, year over year, per state. ggplot2, using `ggplot` and `geom_point`, conveniently groups the state data and displays data points for both categorical and numeric data.
2020

2121
Let's start by importing the data and Seaborn:
2222

@@ -38,8 +38,10 @@ You notice that the honey data has several interesting columns, including year a
3838

3939
Create a basic scatterplot to show the relationship between the price per pound of honey and its U.S. state of origin. Make the `y` axis tall enough to display all the states:
4040

41-
```python
42-
sns.relplot(x="priceperlb", y="state", data=honey, height=15, aspect=.5);
41+
```r
42+
library(ggplot2)
43+
ggplot(honey, aes(x = priceperlb, y = state)) +
44+
geom_point(colour = "blue")
4345
```
4446
![scatterplot 1](images/scatter1.png)
4547

0 commit comments

Comments
 (0)