You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _posts/ggplot2/2019-08-06-geom_jitter.Rmd
+5-2Lines changed: 5 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -185,10 +185,13 @@ chart_link
185
185
### Position Jitterdodge
186
186
Up to this point, we've subdivided points by making one category the x-axis, and facetting by the other. Another way is to make one category the x-axis, then use "position = dodge" so that the points are distinct rather than overlapping. Since we want points to be jittered and dodged, we can use geom\_point with position\_jitterdodge().
187
187
188
+
Make sure to specify the "group" variable: this graph specifies three potential grouping variables (cluster, region, cd_code), and position\_jitterdodge can't tell which two to use unless specified. Further, you can use the ggplotly() function to specify what shows up on the tooltip.
189
+
188
190
```{r, results='hide'}
189
191
library(plotly)
190
192
191
-
p <- ggplot(district_density,aes(x=cluster, y=dem_margin, colour=region)) +
193
+
p <- ggplot(district_density,aes(x=cluster, y=dem_margin, colour=region,
Copy file name to clipboardExpand all lines: _posts/ggplot2/2019-08-06-geom_jitter.md
+6-3Lines changed: 6 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -36,7 +36,7 @@ packageVersion('plotly')
36
36
```
37
37
38
38
```
39
-
## [1] '4.9.0.9000'
39
+
## [1] '4.8.0.9000'
40
40
```
41
41
42
42
### Basic Jitter Plot
@@ -181,11 +181,14 @@ chart_link
181
181
### Position Jitterdodge
182
182
Up to this point, we've subdivided points by making one category the x-axis, and facetting by the other. Another way is to make one category the x-axis, then use "position = dodge" so that the points are distinct rather than overlapping. Since we want points to be jittered and dodged, we can use geom\_point with position\_jitterdodge().
183
183
184
+
Make sure to specify the "group" variable: this graph specifies three potential grouping variables (cluster, region, cd_code), and position\_jitterdodge can't tell which two to use unless specified. Further, you can use the ggplotly() function to specify what shows up on the tooltip.
0 commit comments