Skip to content

Dot sizes are inconsistent in faceted quantile dot plots. #191

Open
@groceryheist

Description

@groceryheist

I want to use stats_dotinterval in a faceted plot. The variance of the data is different within each facet, but comparing across facets is important. The dots in the lower-variance facets are larger than the dots in the smaller-variance facets. I hope to choose scale so that the dots are the same size in each facet, and they are as large as they can be while fitting data from all plots in each row.

Reproducible example.

library(ggplot2)
library(ggdist)

x <- c(rep(rnorm(500,sd=1),3), rep(rnorm(500,sd=0.5),3), rep(rnorm(500,sd=0.1),3))
group.x <- c(1,2,3)
group.y <- c('a','b','c')
y <- c('i','ii','iii')

df <- expand.grid(x=rnorm(500),group.x=group.x, group.y=group.y, y=y)
df[['x']] <- x

ggplot(aes(x=x, y=y), data=df) + stat_dotsinterval(quantiles=50, linewidth=0.5, point_size=1, shape=1) + facet_grid(group.x ~ group.y, as.table=F)

Here's the result
Screenshot_2023-08-05_14-26-03

As a simple workaround, I can set binwidth in stats_dotinterval, but I am making several similar plots with different data and so their scales will be inconsistent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions