Skip to content

Unable to Control Bar Thickness in geom_bar() with size Parameter #6720

@BertramLoong

Description

@BertramLoong

I'm trying to modify the appearance of bars in ggplot2 and increase their thickness in a bar plot created with geom_bar(). I’ve tried adjusting the size parameter, but it doesn’t seem to affect the thickness of the bars. Is there another way to control the thickness of the bars more easily? My ggplot2 version is '4.0.0'. Here's a minimal reproducible example:

data <- data.frame(
  Group = sample(c("a", "b"), 50, replace = TRUE),
  value = rnorm(50, mean = 5, sd = 1)
)

ggplot(data, aes(x = Group, y = value, fill = Group, color = Group)) +
  geom_bar(stat = "summary", fun = "mean", 
           position = position_dodge(width = 0.5), size = 2,
           width = 0.4) +
  scale_color_manual(values = c("a" = "black", "b" = "black")) + 
  theme_minimal() +
  theme(legend.position = "none")
Image

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