Matifou
Matifou

Reputation: 8880

ggplot2: how to change the width of colour aesthetic in a bar/col geometry?

I am making a column/barplot, where I change the fill aesthetic (inner colour of bar) with one variable, and the colour aesthetic (colour around the bar) with another variable. The colour around the bar is not easy to see, so I would like to increase the width of that bar. How can I do that? I don't see any width argument in scale_color_manual?

library(ggplot2)

dat <- data.frame(x = 1:5, y = 1:5, p = 1:5, q = factor(1:5),
                  r = factor(1:5))
data <-  data_frame(x = rep("a", 4),
                    y = c(1,2,4,3),
                    categ = c("1", "2", "3", "4"),
                    group = rep(c("a", "b"), each=2))

ggplot(data, aes(x, y, fill= categ, colour=group)) + 
  geom_col() +
  scale_color_manual(values = c("red", "blue")) 

Thanks!

enter image description here

Upvotes: 2

Views: 1190

Answers (2)

KoenV
KoenV

Reputation: 4283

You may use the size argument

ggplot(data, aes(x, y, fill= categ, colour=group)) + 
  geom_col(size=3) +   ### change
  scale_color_manual(values = c("red", "blue")) 

yielding this:

enter image description here

Upvotes: 5

Maximus
Maximus

Reputation: 1

Rutilities has a "font" function with a host of different fonts identified numerically. For example (font = "11"). Add right into your script and you should be on your way.

Upvotes: 0

Related Questions