my.df <- data.frame(x = rep(1:10, 2),
y = rep(c(1,2), c(10,10)) + rnorm(20),
group = rep(c("A","B"), c(10,10)))
# by default head() is used to show the top rows of data object
# and geom_null() to silence the data returned by the stat
ggplot(my.df, aes(x,y)) +
geom_point() +
stat_debug_panel()
# geom_debug prints the data returned by the stat
ggplot(my.df, aes(x,y)) +
geom_point() +
stat_debug_panel(geom = "debug")
# to print only the the data returned by the stat
# we pass as summary function a function that always returns NULL
ggplot(my.df, aes(x,y)) +
geom_point() +
stat_debug_panel(geom = "debug",
summary.fun = function(x) {NULL})
ggplot(my.df, aes(x,y)) +
geom_point() +
stat_debug_panel(aes(label = sprintf("nrow = %i, ncol = %i, colnames: %s",
after_stat(nrow),
after_stat(ncol),
after_stat(colnames))),
geom = "text")
# here we show all the data object
ggplot(my.df, aes(x,y)) +
geom_point() +
stat_debug_panel(summary.fun = NULL)
ggplot(my.df, aes(x,y)) +
geom_point() +
stat_debug_panel(summary.fun = "nrow")
# with grouping
ggplot(my.df, aes(x,y, colour = group)) +
geom_point() +
stat_debug_panel(summary.fun = NULL)
ggplot(my.df, aes(x,y)) +
geom_point() +
facet_wrap(~group) +
stat_debug_panel()
# by default head() is used to show the top rows of data object
ggplot(my.df, aes(group,y)) +
geom_point() +
stat_debug_panel()
Run the code above in your browser using DataLab