Skip to content

Commit 3e9a886

Browse files
authored
Merge branch 'master' into new-ggplot2-docs
2 parents 9be20f1 + d53af3c commit 3e9a886

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

DESCRIPTION

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,5 @@ Imports:
7272
ggQC,
7373
fmsb,
7474
plotROC,
75-
tidyquant
75+
tidyquant,
76+
ggplot2movies

ggplot2/2021-08-04-violin.Rmd

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ library(ggplot2)
5151
district_density <- read.csv("https://raw.githubusercontent.com/plotly/datasets/master/district_density.csv", stringsAsFactors = FALSE)
5252
district_density$cluster <- factor(district_density$cluster, levels=c("Pure urban", "Urban-suburban mix", "Dense suburban", "Sparse suburban", "Rural-suburban mix", "Pure rural"))
5353
district_density$region <- factor(district_density$region, levels=c("West", "South", "Midwest", "Northeast"))
54-
3
54+
5555
p <- ggplot(district_density,aes(x=cluster, y=dem_margin, fill=cluster)) +
5656
geom_violin(colour=NA) +
5757
geom_hline(yintercept=0, alpha=0.5) +
@@ -205,7 +205,6 @@ Including facetting by region.
205205

206206
Add colour to the facet titles, centre-align the title, rotate the y-axis title, change the font, and get rid of the unnecessary legend. Note that `coord_flip()` flips the axes for the variables and the titles, but does not flip `theme()` elements.
207207

208-
209208
Rotated the x-axis text 45 degrees, and used `facet_grid` to create a 4x1 facet (compared to `facet_wrap`, which defaults to 2x2).
210209

211210
```{r}

0 commit comments

Comments
 (0)