Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ggplot increase border line thickness

Tags:

r

ggplot2

How do I increase the blue border line thickness? The stroke parameter is ignored in my example below.

library(tidyverse)
ggplot(mpg, aes(cty, hwy)) + 
  geom_col(color = "blue", stroke = 2)
like image 515
stackinator Avatar asked Nov 10 '18 15:11

stackinator


People also ask

How do I make my Ggplot line thicker?

To change line width, just add argument size=2 to geom_line().

Which argument of the bar () lets you set the thickness of the bar?

If we want to change the thickness of the bars then size argument under geom_bar function of ggplot2 package can be used and it can be set according to our need starting from 1.


2 Answers

Hopefully this works for you:

ggplot(mpg, aes(cty, hwy,fill="snow")) + 
  geom_bar(color = "navy",size=0.05,stat="identity",alpha=0.3)

The result: enter image description here

Then changing the size aesthetic:

ggplot(mpg, aes(cty, hwy,fill="snow")) + 
  geom_bar(color = "navy",size=2,stat="identity",alpha=0.3)

Yields this: enter image description here

like image 112
NelsonGon Avatar answered Oct 06 '22 00:10

NelsonGon


geom_col does not have a stroke argument. Try this:

   library(tidyverse)
   ggplot(mpg, aes(cty, hwy)) + 
   geom_col(color = "blue", size = 2)
like image 29
Jrakru56 Avatar answered Oct 05 '22 22:10

Jrakru56