r - 有没有办法从分面环绕图中省略具有 NA 值的变量?
问题描述
# A tibble: 8 × 4
measurement log2_fc locus operon
<chr> <dbl> <chr> <chr>
1 transcriptome 1 PA3552 arn
2 transcriptome 1.5 PA3553 arn
3 proteome NA PA3552 arn
4 proteome 2 PA3553 arn
5 transcriptome 2.5 PA1179 opr
6 transcriptome 3 PA1180 opr
7 proteome NA PA1179 opr
8 proteome NA PA1180 opr
plot <- ggplot(data=x,aes(x=locus,y=log2_fc,color=measurement)) +
geom_jitter()
plot + facet_wrap(~operon, ncol=2)
我正在使用上面的代码创建一个比较通过两种不同测量方法获得的基因 log2_fc 的图。我想通过基因所属的操纵子将绘图分开,但我只想让该操纵子中的基因沿着每个方面的 x 轴绘制。目前它正在创建下面的情节:
有没有办法只沿着 x 轴绘制每个轨迹值一次,并且仍然让数据由操作子分隔?
解决方案
您只需要释放 x 轴:
plot + facet_wrap(~operon, ncol=2, scales = "free_x")
如果不指定scales = "free_x"
,则 ggplot 默认为具有相同限制和中断的相同轴。
推荐阅读
- macos - 如何在 OSX Catalina (10.15) 中使用 Wireshark 捕获 USB 流量
- python - 每小时随机播放一次“PASSWORD-HASHERS” Django
- javascript - 如何在同一页面上多次重复使用我的 javascript 滑块?
- postgresql - 是否可以在排除约束中调用函数以仅返回特定列
- amazon-web-services - CloudWatch 重启警报操作未能执行
- objective-c - 如何从包含嵌套 JSON 的 NSDictionary 中提取 NSString
- python - 有什么方法可以在 python 中解码 str 吗?AttributeError:“str”对象没有属性“decode”
- character-encoding - 为什么某些字符(例如“ç”)看起来与其他字符不同?
- python - 我的时间数据“与格式不匹配”。如何正确格式化我的日期时间?
- java - JavaFX 的工具提示 showDuration 不起作用