Hi All,

I have the following code:

-- cut 

(g03_02_p02 <- ggplot(data = d_kzb_input) +
  geom_bar(
    mapping = aes(x = v03_02_r01, y = round(..prop.. * 100, 0)),
    fill = c_ww_palette["blue"]) +
  scale_y_continuous(limits = c(0, c_y_limit)) +
  theme_classic() +
  ggtitle(paste0("Question 3",
    "(n = ", <<cases>>, ")")) +  # How can I refer to the number of cases 
for this plot? Is there something like "..n.."?
  xlab("Orders") +
  ylab("Percent") +
  geom_text(
    aes(label = ..count..),  # How can I refer to the counts for the 
labels of the columns?
    color = "white",
    position = position_stack(vjust = 0.5)))

-- cut --

I would like to refer to the internal statistics of the geom_bar():

How can I refer to the number of cases for this plot? Is there something 
like "..n.."?
How can I refer to the counts for the labels of the columns?

Kind regards

Georg

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to