Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the meaning of dot dot in this ggplot expression? [duplicate]

Tags:

r

ggplot2

I found this expression while working on ggplot.

qplot(carat, ..density.., data = diamonds, facets = color ~ ., geom = "histogram", binwidth = 0.1, xlim = c(0, 3))

How is ..density.. interpreted by R?

Clearly it is not a variable and it is processed inside the function to convey that we want to use the density but I would like to undertand how it works at the language level.

like image 269
mottalrd Avatar asked Sep 27 '22 21:09

mottalrd


1 Answers

Normally, aesthetics are a 1:1 mapping to a column in the input data.frame. In this case, density is an output of the binning for the histogram. So, this the ggplot2 way of referring to certain derivatives that are a by product of an aggregation, such as the binning for a histogram in this case.

like image 97
Paul Hiemstra Avatar answered Sep 30 '22 07:09

Paul Hiemstra