ggplot2 error
1
0
Entering edit mode
Alyaa Mahmoud ▴ 440
@alyaa-mahmoud-4670
Last seen 2.2 years ago
Dear Group I am trying to plot a simple a scatter plot using ggplot, I removed all NA and all rows with zero variance as well but I am still getting the error below: ggplot(df aes(x=df[,1], y=df[,2])) + + geom_point(shape=1) + # Use hollow circles + geom_smooth(method=lm) + # Add linear regression line + theme(axis.text=element_text(size=1)) # (by default includes 95% confidence region) Error in seq.default(from = best$lmin, to = best$lmax, by = best$lstep) : 'from' must be of length 1 any clue ? Thanks a lot Alyaa -- Alyaa Mahmoud "Love all, trust a few, do wrong to none"- Shakespeare [[alternative HTML version deleted]] Regression Regression • 8.1k views ADD COMMENT 0 Entering edit mode Alyaa Mahmoud ▴ 440 @alyaa-mahmoud-4670 Last seen 2.2 years ago I also get this error when I simply use plot: plot (df[,1], df[,2]) Error in plot.window(...) : infinite axis extents [GEPretty(-inf,inf,5)] On Wed, Jan 29, 2014 at 10:55 AM, Alyaa Mahmoud <alyamahmoud@gmail.com>wrote: > Dear Group > > I am trying to plot a simple a scatter plot using ggplot, I removed all NA > and all rows with zero variance as well but I am still getting the error > below: > > ggplot(df aes(x=df[,1], y=df[,2])) + > + geom_point(shape=1) + # Use hollow circles > + geom_smooth(method=lm) + # Add linear regression line > + theme(axis.text=element_text(size=1)) # (by default includes 95% > confidence region) > Error in seq.default(from = best$lmin, to = best$lmax, by = best$lstep) : > 'from' must be of length 1 > > any clue ? > Thanks a lot > > Alyaa > -- > Alyaa Mahmoud > > "Love all, trust a few, do wrong to none"- Shakespeare > -- Alyaa Mahmoud "Love all, trust a few, do wrong to none"- Shakespeare [[alternative HTML version deleted]]
0
Entering edit mode
Hi, On Wed, Jan 29, 2014 at 12:07 AM, Alyaa Mahmoud <alyamahmoud at="" gmail.com=""> wrote: > I also get this error when I simply use plot: > > plot (df[,1], df[,2]) > Error in plot.window(...) : infinite axis extents [GEPretty(-inf,inf,5)] This is not really the right forum for this question, as it is more related to base R than Bioc, but anyway: You must have some weird elements in df[,1] and df[,2] ... and by weird, I mean that there are things in there that plot can't plot. Try to look at the data and see what's there. Is the data stored in these columns numeric? Are there infinite values? Are there NaNs, NAs, etc? Look at is.finite, is.nan, is.numeric to answer those questions. Also looking at range(df[,1]) (and df[,2]) as well as summary(df[,1]) (and df[,2]) could be helpful. Trying to plot one axis against a "known good one" could be helpful. For instance, assuming these columns are indeed numeric, to test df[,1] you could just: R> plot(df[,1]) and see if you get an error. Try the same for df[,2] HTH, -steve -- Steve Lianoglou Computational Biologist Genentech
0
Entering edit mode
Thanks a lot Steve. resolved using is.finite() On Wed, Jan 29, 2014 at 8:12 PM, Steve Lianoglou <lianoglou.steve@gene.com>wrote: > Hi, > > On Wed, Jan 29, 2014 at 12:07 AM, Alyaa Mahmoud <alyamahmoud@gmail.com> > wrote: > > I also get this error when I simply use plot: > > > > plot (df[,1], df[,2]) > > Error in plot.window(...) : infinite axis extents [GEPretty(-inf,inf,5)] > > This is not really the right forum for this question, as it is more > related to base R than Bioc, but anyway: > > You must have some weird elements in df[,1] and df[,2] ... and by > weird, I mean that there are things in there that plot can't plot. Try > to look at the data and see what's there. > > Is the data stored in these columns numeric? > Are there infinite values? > Are there NaNs, NAs, etc? > > Look at is.finite, is.nan, is.numeric to answer those questions. > Also looking at range(df[,1]) (and df[,2]) as well as > summary(df[,1]) (and df[,2]) could be helpful. > > Trying to plot one axis against a "known good one" could be helpful. > For instance, assuming these columns are indeed numeric, to test > df[,1] you could just: > > R> plot(df[,1]) > > and see if you get an error. Try the same for df[,2] > > HTH, > > -steve > > -- > Steve Lianoglou > Computational Biologist > Genentech > -- Alyaa Mahmoud "Love all, trust a few, do wrong to none"- Shakespeare [[alternative HTML version deleted]]