首页
\
问答
\
使用ggplot2 geom_tile()+ geom_point()突出显示切片(Highlight tiles with ggplot2 geom_tile() + geom_point())
使用ggplot2 geom_tile()+ geom_point()突出显示切片(Highlight tiles with ggplot2 geom_tile() + geom_point())
我有以下情节,如下所示:
我正在尝试根据此处的以下代码在另一层中添加点
我导入的数据框如下所示:
residue_id residue_num per_ddg pg9_seq_bool A 96 0.00437094862845686 FALSE A 97 -0.0026333752377897 FALSE A 98 -0.00453070737795937 FALSE A 99 -0.0130564560942629 TRUE A 100 -0.00578979380922636 FALSE A 101 -0.0128130535970934 FALSE A 102 -0.0264740211311766 FALSE A 103 -0.183036342874782 FALSE A 104 -0.00550669729238368 FALSE
并使用以下代码生成图:
library(ggplot2) input_ddg <-read.table('per_residue_average.txt',header=T,sep="\t",stringsAsFactors=TRUE) input_ddg$pg9_seq_bool[input_ddg$pg9_seq == "TRUE"] <- T input_ddg$pg9_seq_bool[input_ddg$pg9_seq == "FALSE"] <- F pdf("output.pdf") ggplot(input_ddg, aes(residue_id,residue_num,fill=per_ddg) ) + theme_bw() + geom_tile() + geom_point(data=input_ddg,aes(size=ifelse(pg9_seq_bool, "dot", "no_dot"))) + scale_size_manual(values=c(dot=6,no_dot=NA))+ scale_fill_gradient2(low="blue", mid="white",high="red", midpoint=-.25, na.value="black") + ylab( "Residue Number" ) + xlab( "Mutation Identity") + scale_y_continuous(breaks=96:125,expand=c(0,0))+ scale_x_discrete(expand=c(0,0))+ labs(fill=expression(Delta*Delta*"G(REU)")) + ggtitle(expression("Average"~Delta*Delta*"G for Mutations by CDR3 Position")) + theme( panel.background=element_rect(fill="black"), panel.grid.minor=element_blank(), panel.grid.major=element_blank()) dev.off()
我收到一个错误:
Error in grid.Call.graphics(L_setviewport, pvp, TRUE) : Non-finite location and/or size for viewport Calls: print ... lapply -> FUN -> push.vp.viewport -> grid.Call.graphics In addition: Warning message: Removed 461 rows containing missing values (geom_point). Execution halted
我有一种感觉,因为我使用ifelse解析了TRUE和FALSE,但我完全按照了帖子。
I have the following plot that looks like:
I'm trying to add points in another layer using according to the following code found here
My data frame i'm importing looks like this:
residue_id residue_num per_ddg pg9_seq_bool A 96 0.00437094862845686 FALSE A 97 -0.0026333752377897 FALSE A 98 -0.00453070737795937 FALSE A 99 -0.0130564560942629 TRUE A 100 -0.00578979380922636 FALSE A 101 -0.0128130535970934 FALSE A 102 -0.0264740211311766 FALSE A 103 -0.183036342874782 FALSE A 104 -0.00550669729238368 FALSE
and uses the following code to generate the plot:
library(ggplot2) input_ddg <-read.table('per_residue_average.txt',header=T,sep="\t",stringsAsFactors=TRUE) input_ddg$pg9_seq_bool[input_ddg$pg9_seq == "TRUE"] <- T input_ddg$pg9_seq_bool[input_ddg$pg9_seq == "FALSE"] <- F pdf("output.pdf") ggplot(input_ddg, aes(residue_id,residue_num,fill=per_ddg) ) + theme_bw() + geom_tile() + geom_point(data=input_ddg,aes(size=ifelse(pg9_seq_bool, "dot", "no_dot"))) + scale_size_manual(values=c(dot=6,no_dot=NA))+ scale_fill_gradient2(low="blue", mid="white",high="red", midpoint=-.25, na.value="black") + ylab( "Residue Number" ) + xlab( "Mutation Identity") + scale_y_continuous(breaks=96:125,expand=c(0,0))+ scale_x_discrete(expand=c(0,0))+ labs(fill=expression(Delta*Delta*"G(REU)")) + ggtitle(expression("Average"~Delta*Delta*"G for Mutations by CDR3 Position")) + theme( panel.background=element_rect(fill="black"), panel.grid.minor=element_blank(), panel.grid.major=element_blank()) dev.off()
I'm getting an error:
Error in grid.Call.graphics(L_setviewport, pvp, TRUE) : Non-finite location and/or size for viewport Calls: print ... lapply -> FUN -> push.vp.viewport -> grid.Call.graphics In addition: Warning message: Removed 461 rows containing missing values (geom_point). Execution halted
I have a feeling its to due with my parsing of the TRUE and FALSE with ifelse, but I followed the post exactly.
原文:
更新时间:2022-01-27 11:01
最满意答案
没有公开的方法将图形图标放在菜单中。 您可以做的最好的事情是使用Unicode字符,例如
✘
和☢
There is no exposed method to put graphic icons in the menu. The best you can do is use Unicode characters such as
✘
and☢
相关问答
更多-
相关问题: JS Maps v3:带有用户个人资料图片的自定义标记 使用那里的代码,并将border-radius更改为50%,给我一个圆形图标,圆圈中的图像。 概念证明小提琴 //adapted from http://gmaps-samples-v3.googlecode.com/svn/trunk/overlayview/custommarker.html function CustomMarker(latlng, map, imageSrc) { this.latlng_ = latlng; ...
-
2个选项: 1)你可以在清单中设置标志(或者像上面那样以编程方式设置)来分割ActionBar ,但只有当你在一个手机大小的设备上时,这只能用于纵向,即使这样它仍然有ActionBar出现在顶部,但将前几个ActionItem移动到底部。 对于大多数情况来说这没什么问题,但听起来你总是说你总是希望这个底部显示,你将使用的系统菜单没有能力达到你想要的程度。 2)在屏幕底部创建自己的布局,以创建您正在谈论的样式菜单。 这可能有效: < ...
-
如何在UWP中的NavigationViewMenuItems中添加自定义图标(How to add custom icons in NavigationViewMenuItems in UWP)[2022-05-09]
您可以添加自定义图标使用