gpt4 book ai didi

r - GGplot Barplot 不接受 Y 值?

转载 作者:行者123 更新时间:2023-12-04 10:25:36 25 4
gpt4 key购买 nike

我有一个数据框:

>picard
count reads
1 20681318
2 3206677
3 674351
4 319173
5 139411
6 117706

如何在 ggplot (barplot) 上绘制 log10(count) 与 log10(reads)?

我试过:
ggplot(picard) + geom_bar(aes(x=log10(count),y=log10(reads)))

但它不接受 y=log10(reads)。我如何绘制我的 y 值?

最佳答案

你可以做这样的事情,但是用 log10 比例绘制不连续的 x 轴对我来说没有意义:

ggplot(picard) +
geom_bar(aes(x=count,y=reads),stat="identity") +
scale_y_log10() +
scale_x_log10()

enter image description here

如果您只想要一个带有 log10 比例的 y 轴,请执行以下操作:
ggplot(picard) +
geom_bar(aes(x=count,y=reads),stat="identity") +
scale_y_log10()

enter image description here

关于r - GGplot Barplot 不接受 Y 值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19389888/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com