Error in seq.default(min, max, by = by) : 'from' cannot be NA, NaN or infinite

11,656 views
Skip to first unread message

oliver.b...@gmail.com

unread,
Dec 16, 2014, 9:18:48 AM12/16/14
to ggp...@googlegroups.com
Hi,

We are using CummeRbund (ggplot2_1.0.0) and we have rely confusing problem with one of our data set which we tried to visualize

We localized function which throws the error, and this is the functions call:

p<-ggplot(dat)
p<-p+geom_point(aes(x=count,y=dispersion,color=sample_name)) + facet_wrap('sample_name') + scale_x_log10() + scale_y_log10()
p

and this is the error:

Error in seq.default(min, max, by = by) : 
  'from' cannot be NA, NaN or infinite


When we omit scale_x_log10() + scale_y_log10() the call finish without error

p<-ggplot(dat)
p<-p+geom_point(aes(x=count,y=dispersion,color=sample_name)) + facet_wrap('sample_name') 
p

We exported "dat" into dat.csv, you can find it as attachment

We tried ploting this data set with another tool and we succeed: This is the code:

plot(dat$count,dat$dispersion,log = "xy") 

We also use some functions to examine our data set:

> length(log10(dat$dispersion))
[1] 190971
> length(na.omit(log10(dat$dispersion)))
[1] 190971
> range(log10(dat$count))
[1]     -Inf 5.870399
> range(log10(dat$dispersion))
[1]     -Inf 12.24184

>
 
and we didn't find anything unusual. We compared those results with results from data set which we can visualize and we didn't find anything.

This is results from functions calls against successfully visualized  data set.

> length(log10(dat$dispersion))
[1] 114714
> length(na.omit(log10(dat$dispersion)))
[1] 114714
> range(log10(dat$count))
[1]     -Inf 5.500933
> range(log10(dat$dispersion))
[1]     -Inf 11.15269

Can you help us with this?

dat.csv.tar.gz

Henrik Bengtsson

unread,
Dec 16, 2014, 11:09:44 AM12/16/14
to oliver.b...@gmail.com, ggp...@googlegroups.com

On Dec 16, 2014 6:27 AM, <oliver.b...@gmail.com> wrote:
>
> Hi,
>
>
> We are using CummeRbund (ggplot2_1.0.0) and we have rely confusing problem with one of our data set which we tried to visualize
>
> We localized function which throws the error, and this is the functions call:
>
> p<-ggplot(dat)
> p<-p+geom_point(aes(x=count,y=dispersion,color=sample_name)) + facet_wrap('sample_name') + scale_x_log10() + scale_y_log10()
> p
>
> and this is the error:
>
> Error in seq.default(min, max, by = by) :
>   'from' cannot be NA, NaN or infinite
>
>
>
> When we omit scale_x_log10() + scale_y_log10() the call finish without error

Try to keep one of them to see if you can narrow down whether the problem is in the x or y signals or both.

My $0.02

Henrik

> --
> --
> You received this message because you are subscribed to the ggplot2 mailing list.
> Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility
>  
> To post: email ggp...@googlegroups.com
> To unsubscribe: email ggplot2+u...@googlegroups.com
> More options: http://groups.google.com/group/ggplot2
>
> ---
> You received this message because you are subscribed to the Google Groups "ggplot2" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+u...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Oliver Bradonjic

unread,
Dec 16, 2014, 11:15:42 AM12/16/14
to ggp...@googlegroups.com, oliver.b...@gmail.com, h...@biostat.ucsf.edu
Hi Henrik,

Thanks for a replay.

I have problem in both case:

p<-ggplot(dat)
p<-p+geom_point(aes(x=count,y=dispersion,color=sample_name)) + facet_wrap('sample_name') + scale_x_log10() 
p

Error in seq.default(min, max, by = by) : 
  'from' cannot be NA, NaN or infinite

p<-ggplot(dat)
p<-p+geom_point(aes(x=count,y=dispersion,color=sample_name)) + facet_wrap('sample_name') + scale_y_log10()
p

Error in seq.default(min, max, by = by) : 
  'from' cannot be NA, NaN or infinite

Brandon Hurr

unread,
Dec 16, 2014, 11:29:42 AM12/16/14
to Oliver Bradonjic, ggplot2, oliver.b...@gmail.com, h...@biostat.ucsf.edu
It says it can't be infinite and your range says it is infinite.
> range(log10(dat$count))
[1]     -Inf 5.500933
> range(log10(dat$dispersion))
[1]     -Inf 11.15269

Why do you expect it to work?

oliver.b...@gmail.com

unread,
Dec 16, 2014, 1:15:56 PM12/16/14
to ggp...@googlegroups.com, oliver.b...@sbgenomics.com, oliver.b...@gmail.com, h...@biostat.ucsf.edu
Hi Brandon,

The example from your post shows function results for a working data set :). As you can see the first result show stats for a data set which throws a error and secon for a working data set.They all have -inf in range. 

You can see in orginal post that the first one is for data set which throws an error and a second one for a data set which can be visualize

> length(log10(dat$dispersion))
[1] 190971
> length(na.omit(log10(dat$dispersion)))
[1] 190971
> range(log10(dat$count))
[1]     -Inf 5.870399
> range(log10(dat$dispersion))
[1]     -Inf 12.24184

>


> length(log10(dat$dispersion))
[1] 114714
> length(na.omit(log10(dat$dispersion)))
[1] 114714
> range(log10(dat$count))
[1]     -Inf 5.500933
> range(log10(dat$dispersion)) 
[1] -Inf 11.15269"

Brandon Hurr

unread,
Dec 16, 2014, 2:08:01 PM12/16/14
to oliver.b...@gmail.com, ggplot2, oliver.b...@sbgenomics.com, h...@biostat.ucsf.edu
Seems like a bug to me. 

If you set some limits it's not just the 0's in count and dispersion as I originally thought it was.

Using the range values (without logs) still gives the error if you skirt 0 (1e-307) as the minimum value. It's the maximum value of the range too. If you set the limits of each axes to less than the maximum value it plots fine, but then you're missing data points. 

> ggplot(data = filteredDAT, aes(x=count,y=dispersion,color=sample_name)) + geom_point() + facet_wrap('sample_name') + scale_x_log10(limits = c(1e-307, 100000000000)) + scale_y_log10(limits = c(1e-307, 100000000000))
Warning messages:
1: Removed 1 rows containing missing values (geom_point). 
2: Removed 6 rows containing missing values (geom_point). 
3: Removed 1 rows containing missing values (geom_point). 

Alternatively, if you log the values and get rid of the scale transformation, it plots fine. 

ggplot(data = filteredDAT, aes(x=log10(count),y=log10(dispersion),color=sample_name)) + geom_point() + facet_wrap('sample_name')


Inline image 3
Can you move forward from here? I don't see an alternative. You should be able to edit your axes and get what you seem to want. 

B

Oliver Bradonjic

unread,
Dec 17, 2014, 4:51:36 AM12/17/14
to ggp...@googlegroups.com, oliver.b...@gmail.com, oliver.b...@sbgenomics.com, h...@biostat.ucsf.edu
Brandon,

Thank you very much for your help. Yes I can move forward, I will use ggplot not CummeRbund for this :)

BR
Oliver
Reply all
Reply to author
Forward
0 new messages