ggplot2: Viewing data generated for a plot
Frequently, I use functions to shape or numerically alter data that I'm passing to ggplot, so that I don't have to alter my data before putting it in.
If I've saved a plot to a variable. Is there a way to see the actual data that I'm plotting? It'开发者_Go百科s a sanity check.
For example:
c <- ggplot(mtcars, aes(factor(cyl))) + geom_bar()
If I type str(c)
, I'm presented with $data at the top, but I would like to see it in tabular form.
c$data
Now I have to pad this out so stackoverflow doesn't reject it for being too small an answer.
精彩评论