0
votes

I have a variable q in a dataframe t I want to limit the x_axis with log10 scale

#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?

1
Glad to help! One other quick comment -- t is a common R function used to transpose matrices, so it would be best to pick a different name for your data frame.josliber

1 Answers

4
votes

The log of 0 is negative infinity, so you would have a really long x axis! Try limits=c(0.1, 1) instead in the ggplot call.