当包没有此功能时如何调整 R 中人体图的线宽
我正在使用 CHOIRBM 包(https://github.com/emcramer/CHOIRBM)并制作一张显示全身患病率和疼痛的身体图。我想改变身体图本身的线条粗细,但该包似乎没有该选项。该包是在 ggplot 包之上构建的,所以我想知道是否有某种我不知道的 ggplot 命令可以做到这一点。 这是代码。请注意,id= 身体区域,Percent= 疼痛百分比,group= 身体正面或背面。包装要求物品以这种方式贴上标签。这就是地图的样子:
painF %>% filter(value == 1) %>% select(id, Percent, group) %>%
plot_female_choirbm(value="Percent") +
scale_fill_gradient(low="white", high="red", limits=c(0,10)) +
theme(legend.position = "bottom") +
labs(fill = "Prevelance of pain (%)")+
ggtitle(" " , subtitle="Female")+
theme(plot.subtitle=element_text(face="bold", hjust=0.5))
I am working with the CHOIRBM package (https://github.com/emcramer/CHOIRBM) and made a body map looking at prevalence and pain throughout the body. I want to alter the thickness of the lines on the bodymap itself but the package doesn't appear to have that option. The package was built on top of the ggplot package however so I was wondering if there was some type of ggplot command that I'm not aware that will do this.
Here is the code. Note that id= region of the body, Percent= percent of pain, and group= front or back of body. The package requires things to be labeled this way. And this is what the map looks like:
painF %>% filter(value == 1) %>% select(id, Percent, group) %>%
plot_female_choirbm(value="Percent") +
scale_fill_gradient(low="white", high="red", limits=c(0,10)) +
theme(legend.position = "bottom") +
labs(fill = "Prevelance of pain (%)")+
ggtitle(" " , subtitle="Female")+
theme(plot.subtitle=element_text(face="bold", hjust=0.5))
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
似乎没有直接的方法可以做到这一点,但您可以间接地做到这一点,因为它最终是由
geom_polygon
构建的。首先存储绘图:现在您将覆盖多边形图层的尺寸美感:
请注意,多边形可能不再完美重叠。
从 GitHub 示例生成的数据
There doesn't seem to be a direct way to do this, but you can do it indirectly since it is built ultimately out of
geom_polygon
. First store the plot:Now you overwrite the size aesthetic of the polygon layer:
Note that the polygons may no longer overlap perfectly any more.
Data generated from GitHub example