-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
Please place an "x" in all the boxes that apply
- I have the most recent version of this package and R
- I have found a bug
- I have a reproducible example
- I want to request a new feature
Please include a brief description of the problem with a code example:
# insert reprex here
# make plot
> ggplot()+
+
+ # bar graph of the "negative" responses
+ geom_bar(
+ data = melted %>% filter(direction == "Negative"),
+ mapping = aes(
+ x = status,
+ y = after_stat(count)*(-1), # counts inverted to negative
+ fill = Response),
+ color = "black",
+ closed = "left",
+ position = "stack")+
+
+ # bar graph of the "positive responses
+ geom_bar(
+ data = melted %>% filter(direction == "Positive"),
+ mapping = aes(
+ x = status,
+ fill = Response),
+ colour = "black",
+ closed = "left",
+ position = "stack")+
+
+ # flip the X and Y axes
+ coord_flip()+
+
+ # Black vertical line at 0
+ geom_hline(yintercept = 0, color = "black", size=1)+
+
+ # convert labels to all positive numbers
+ scale_y_continuous(
+
+ # limits of the x-axis scale
+ limits = c(-ceiling(melted_max/10)*11, # seq from neg to pos by 10, edges rounded outward to nearest 5
+ ceiling(melted_max/10)*10),
+
+ # values of the x-axis scale
+ breaks = seq(from = -ceiling(melted_max/10)*10,
+ to = ceiling(melted_max/10)*10,
+ by = 10),
+
+ # labels of the x-axis scale
+ labels = abs(unique(c(seq(-ceiling(melted_max/10)*10, 0, 10),
+ seq(0, ceiling(melted_max/10)*10, 10))))) +
+
+ # color scales manually assigned
+ scale_fill_manual(
+ values = c("Very Good" = "green4", # assigns colors
+ "Good" = "green3",
+ "Poor" = "yellow",
+ "Very Poor" = "red3"),
+ breaks = c("Very Good", "Good", "Poor", "Very Poor"))+ # orders the legend
+
+
+
+ # facet the entire plot so each question is a sub-plot
+ facet_wrap( ~ Question, ncol = 3)+
+
+ # labels, titles, caption
+ labs(
+ title = str_glue("Likert-style responses\nn = {nrow(likert_data)}"),
+ x = "Respondent status",
+ y = "Number of responses",
+ fill = "")+
+
+ # display adjustments
+ theme_minimal()+
+ theme(axis.text = element_text(size = 12),
+ axis.title = element_text(size = 14, face = "bold"),
+ strip.text = element_text(size = 14, face = "bold"), # facet sub-titles
+ plot.title = element_text(size = 20, face = "bold"),
+ panel.background = element_rect(fill = NA, color = "black")) # black box around each facet
warning message:
1: In geom_bar(data = melted %>% filter(direction == "Negative"), mapping = aes(x = status, :
Ignoring unknown parameters: `closed`
2: In geom_bar(data = melted %>% filter(direction == "Positive"), mapping = aes(x = status, :
Ignoring unknown parameters: `closed`I think this parameters:closed is not in geom_bar ? why author write in geom_bar? Now what need i do? Thanks anyone who solve my confusion!
Metadata
Metadata
Assignees
Labels
No labels