ComplexUpset中按集合颜色手动设置交集矩阵点的颜色
解决方法
你只需要在scale_color_manual()中添加guide = "none"参数,关闭额外生成的color映射图例即可,修改后的完整代码如下:
movies <- read.csv( system.file("extdata", "movies.csv", package = "UpSetR"), header=T, sep=";" ) ComplexUpset::upset(movies, colnames(movies)[3:5], name='genre', width_ratio=0.1, matrix=(intersection_matrix(geom=geom_point()) + scale_color_manual( values = c('Action'='red', 'Adventure'='blue', 'Children'='yellow'), guide = "none" # 关闭额外的颜色图例 )), queries=list(upset_query(set='Action', fill='red'), upset_query(set='Adventure', fill='blue'), upset_query(set='Children', fill='yellow')))
多余图例是scale_color_manual默认生成的颜色映射图例,添加参数禁用后不会影响实际的点颜色匹配效果,交集点的连接线段默认保持黑色,无需额外配置。
内容的提问来源于stack exchange,提问作者moniker
相关产品推荐
相关产品推荐

