Skip to content

geom_boxplot with stat="identity" cannot recognize width parameter #2893

Closed
@artidataio

Description

@artidataio

These 2 plots should be the same:

set.seed(240193)
df1 <- data.frame(person=rep(c("a","b"),each = 10),
                  score=c(rnorm(10,8,1),rnorm(10,6,1.5)))

ggplot(df1)+
  geom_boxplot(aes(x=person,y=score),width=0.1)

image

df2 <- cbind(person = c("a","b"),
             as.data.frame(matrix(c(boxplot.stats(df1[1:10,2])$stats,
                                    boxplot.stats(df1[11:20,2])$stats),nrow=2,byrow=T)))

ggplot(df2)+
  geom_boxplot(aes(x = person,
                   ymin = V1,
                   lower = V2,
                   middle = V3,
                   upper = V4, 
                   ymax = V5),
               stat= "identity",width=0.1)

image

Instead I got this message = "Warning: Ignoring unknown parameters: width"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions