DamonJW
DamonJW

Reputation: 3682

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

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(...).

Upvotes: 6

Views: 2118

Answers (1)

Ista
Ista

Reputation: 10437

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.

Upvotes: 2

Related Questions