本文介绍了GGplot Barplot不接受Y值吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个数据框:
>picard
count reads
1 20681318
2 3206677
3 674351
4 319173
5 139411
6 117706
如何在ggplot(条形图)上绘制log10(计数)与log10(读数)?
How do I plot log10(count) vs log10(reads) on a ggplot (barplot)?
我尝试过:
ggplot(picard) + geom_bar(aes(x=log10(count),y=log10(reads)))
但是它不接受y = log10(读取).如何绘制我的y值?
But it is not accepting y=log10(reads). How do I plot my y values?
推荐答案
您可以执行类似的操作,但绘制x轴(不连续,对数为10)对我来说没有意义:
You can do something like this, but plotting the x axis, which is not continuous, with a log10 scale doesn't make sense for me :
ggplot(picard) +
geom_bar(aes(x=count,y=reads),stat="identity") +
scale_y_log10() +
scale_x_log10()
如果您只希望y轴的对数为10,则只需执行以下操作即可:
If you only want an y axis with a log10 scale, just do :
ggplot(picard) +
geom_bar(aes(x=count,y=reads),stat="identity") +
scale_y_log10()
这篇关于GGplot Barplot不接受Y值吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!