How does it work...

As a result from running step 1, we get a basic dot plot made via geom_dotplot(). Argument binaxis receives a string telling the axis to bin dots along. Here the dotzise argument was also changed, so dots from different ranks wouldn't overlay one another. This argument is very susceptible to image proportion/size. Try exporting figure with different widths and heights to see how the plot behaves. Last named argument was stackdir (stack direction) and it tells the dots to be centered.

Figure 3.4 sizes aer 528x528. Usually, your images have to fit a specific size. A good practice is to preview the image before actually exporting it. The parameter dotsize must be adjusted so it fits your sizing needs and not the other way round.

The next step only adds aes(fill = sex) to geom_dotplot(), thus coloring the dots according to the sex displayed by each observation. Still, note that for the colored output, one color almost overlays another. This is an actual issue on GitHub (tydeverse/ggplot2, issue #1096). There is a way to contour it, as the next recipe shall stress. For now, let me tell about two other arguments not used yet.