Closed nicholasjhorton closed 6 years ago
Can you please give me an example of what it generates and what you are trying to generate?
library(mosaic) Titanic <- read_csv("http://nhorton.people.amherst.edu/is5/data/Titanic.csv") barplot(tally(~ Survived | Class, format = "percent", data = Titanic), beside = TRUE) barplot(tally(~ Class | Survived, format = "percent", data = Titanic)) gf_bar(~ Survived | Class, format = "percent", data = Titanic)
The first two plots are are the ones that I want, but gf_bar automatically facets.
Do the commands:
library(mosaic) library(readr) Titanic <- read_csv("http://nhorton.people.amherst.edu/is5/data/Titanic.csv") gf_bar(~ Survived, fill = ~ Class, data = Titanic) gf_bar(~ Survived | Class, fill = ~ Survived, data = Titanic)
fit the bill?
The problem that I'm running into is that the bars in the stacked plot are proportions of each other: library(mosaic) library(readr) Titanic <- read_csv("http://nhorton.people.amherst.edu/is5/data/Titanic.csv") gf_percents(~ Survived, fill = ~ Class, data = Titanic)
Can you try to replicate this using ggplot2?
Can you please point me to your commit? Thanks in advance, Nick
Thanks. Is the barplot() command still needed? Can you give the reader some sense of where the various displays show up in the chapter?
gf_bar() automatically facets when there are multiple variables, and I'm not sure how to change it.