I have a dot plot and I'd like to color the dots so I have a `d$color` vector that corresponds to the color for a particular dot.

Question 1:
When you run the code below you can see the dots are not colored properly? Do you know how to color them properly? The code needs to dynamically handle the situation where the colors change. For example in this case "red" is the first color but that will not always be the case.

Question 2: Do you also know how to make the dots filled instead of transparent?

```
library(mosaic)
binwidth <- 1
dat <- c(1, 1, 1, 2, 3, 3, 4, 4, 5, 5)
d <- data.frame(x=dat, color=c("red", "green", "blue", "blue", "purple", "red",
                               "red", "blue", "green", "green"))
dotPlot(~x, data=d, groups=color, 
        breaks=seq(min(d$x) - binwidth, max(d$x) + binwidth, binwidth), 
        cex=1, col=as.factor(d$color))

```

Question 3: Can you run this code? The soltuion does not seem to work here:

```
n=50
r =rnorm(n)
dat = sample(r ,n= 1,size = n, replace = TRUE)
d = data.frame( x = dat, color = c(rep("red",n/2), rep("green",n/2)))
dotPlot(d$x,  breaks = seq(min(d$x)-.1,max(d$x)+.1,.1)) # this works
dotPlot(d$x,  breaks = seq(min(d$x)-.1,max(d$x)+.1,.1), groups = color,col = levels(d$color) ) # this does not work

```