I am trying to plot several features of a group of samples to various aesthetics. Border color and size of a circle is one of them. However, if I try to set a larger baseline border for these shapes, by setting lwd=2, the shapes all revert to the same size and the legend is gone. I just want the circles to have a larger border, how can I do this?
An example:
library(ggplot2)
testFrame <- data.frame(
sizeVar=factor(c('a', 'a', 'a', 'a', 'b', 'b', 'b', 'b')),
samples=rep(c('Sample1', 'Sample2'), times=4),
features=c(rep('Feature1', times=4), rep('Feature2', times=4))
)
testPlot <- ggplot(data=testFrame, aes(x=samples, y=features))
testPlot +
geom_point(aes(size=sizeVar), pch=21, color='black', fill='gray') +
scale_size_manual(values=c(9,4)) + theme_bw()
testPlot +
geom_point(aes(size=sizeVar), pch=21, lwd=3, color='black', fill='gray') +
scale_size_manual(values=c(9,4)) + theme_bw()


Start with your graph:
List the elements:
Now to change the appropriate element: