# Question on the double dots in this mission

https://app.dataquest.io/m/397/visualizing-frequency-distributions/3/proportions-with-bar-charts

what is the purpose of the double dots? …y… and …x…?

2 Likes

Hi @thompson.eric.m. Good question. The double dots in `ggplot2` are a handy feature that allow users to specify a particular calculation to perform for a given axis in a plot. In this screen, for example, we want to see the proportion of players in each position, rather than the count.

If we wanted to specify count using this double dot method, we could do that too:

``````ggplot(data = wnba,
aes(x = Pos,
y = ..count..,
group = 1)) +
geom_bar() +
theme(legend.position = "none")
``````

And this generates a standard bar chart with counts for each position:

If you’d like to dig into the techical details, checkout this StackOverflow post.

Best,
-Casey

In the same section, there is fill = factor(…x…) (Code below). Why is fill applied with factor(…x…)?
Code:
ggplot(data = wnba,
aes(x = Pos,
y = …prop… * 100,
group = 1,
fill = factor(…x…)))

I was curious about this too. I’ve read the linked Stack Overflow article in the accepted answer, but I still don’t understand what’s going on here.

Here’s a way to make my question more concrete: if I run the following, I get a nice colored bar chart like in the demonstration, but of frequencies, not proportions:

``````ggplot(data = wnba,
aes(x = Pos,
fill = Pos)) +
geom_bar() +
theme(legend.position = "none") +
labs(x = "Position",
y = "Percentage")
``````

So, why does the code below give a gray graph? The only change is adding the y and group parameters, but leaving `fill = Pos` instead of using `fill = factor(..x..)` as suggested in the lesson.

``````ggplot(data = wnba,
aes(x = Pos,
y = ..prop.. * 100,
group = 1,
fill = Pos)) +
geom_bar() +
theme(legend.position = "none") +
labs(x = "Position",
y = "Percentage")
``````