Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Documentation for special variables in ggplot (..count.., ..density.., etc.)

Tags:

r

ggplot2

The stats_ functions in ggplot2 create special variables, e.g. stat_bin2d creates a special variable called ..count... Where can I find documentation listing which special variables are returned by which stat_ function?

I've looked on the main ggplot2 documentation pages, and in R online help. I tried reading the source code for stat_bin2d, but it uses bits of the language I don't understand -- I don't know how to get at the code behind StatBin2d$new(...).

like image 592
DamonJW Avatar asked Mar 21 '13 19:03

DamonJW


1 Answers

Most of them are documented in the value section of the help pages, e.g., ?stat_boxplot says

Value:

 A data frame with additional columns:

width: width of boxplot

ymin: lower whisker = smallest observation greater than or equal to
      lower hinge - 1.5 * IQR

lower: lower hinge, 25% quantile

notchlower: lower edge of notch = median - 1.58 * IQR / sqrt(n)

middle: median, 50% quantile

notchupper: upper edge of notch = median + 1.58 * IQR / sqrt(n)

upper: upper hinge, 75% quantile

ymax: upper whisker = largest observation less than or equal to
      upper hinge + 1.5 * IQR

I suggest submitting bug reports for those that remain undocumented. There is a bug report for stat_bin2d, but it was closed as fixed. If you create a new bug report you can refer to that one.

like image 195
Ista Avatar answered Oct 25 '22 02:10

Ista