简体   繁体   English

ggplot R比例x log10限制不起作用

[英]ggplot R scale x log10 limits not working

I have a variable q in a dataframe t I want to limit the x_axis with log10 scale 我在数据x_axis t有一个变量q我想用log10 scale limit x_axis

#t$q
1.000000 2.500000 2.733333 3.032258 1.545455 1.967213 1.176471 1.000000 2.533333 3.136364 1.967213
ggplot(t,aes(x=q))+geom_freqpoly(binwidth=0.1)+scale_x_log10(limits=c(0,1))+scale_y_log10()

I got this error : 我收到此错误:

Error in if (diff(range) == 0) { : missing value where TRUE/FALSE needed
Error in exists(name, envir = env, mode = mode) : 
  argument "env" is missing, with no default

What's wrong? 怎么了?

The log of 0 is negative infinity, so you would have a really long x axis! 对数0为负无穷大,因此您的x轴会很长! Try limits=c(0.1, 1) instead in the ggplot call. 尝试在ggplot调用中使用limits=c(0.1, 1) ggplot

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM