Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Width of edge of the bars in R plots

Tags:

r

Is there a way to set the width the the edge of the bars in R plots? For example when I set

test <- read.csv(file="test4.csv",sep=",",head=TRUE)
pdf(file="test.pdf", height=4, width=6)
barplot(as.matrix(test[,2:ncol(test)]), col=heat.colors(10), space=0.5)
dev.off()

I get this.

This is the output

But the edges of all the bars are very thick compared to the width of the bars themselves, hence the high level of black at the bottom and in the smaller bars.

like image 529
Julio Diaz Avatar asked Dec 17 '22 05:12

Julio Diaz


1 Answers

You can set the line width before plotting.

opar <- par(lwd = 0.3)

This will make thinner bars but not affect your axes (as they are set separately).

like image 135
John Avatar answered Jan 03 '23 04:01

John