我试图将一组样本的几个特征绘制成各种美学.边框颜色和圆圈的大小就是其中之一.但是,如果我尝试为这些形状设置更大的基线边框,通过设置lwd=2
,形状全部恢复到相同的大小,图例就消失了.我只是希望圆圈有更大的边框,我该怎么做?
一个例子:
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()
Run Code Online (Sandbox Code Playgroud)