Hi, is there any way to set the ylim range from zero to whatever is the max value in that dataset? I am plotting many similar plots to the one below, and would like to avoid having to find the max value each time. plot (D10$Part.P ~ D10$Klorofyll,pch=16,log = "xy", xlab = ("Chla"), ylab ("POP"), ylim = c (0, ???)) abline(m3, untf=TRUE, lty=1,col="blue") text(5, 0.05,paste(round(glm(D10$Part.P ~ D10$Klorofyll, data = D10, family = Gamma(link = "identity"))$coef, 2),collapse = " ")) thank you very much for your time and help. Best regards, Helene Frigstad -- View this message in context: http://old.nabble.com/denoting-max-value-in-ylim-tp26441589p26441589.html Sent from the R help mailing list archive at Nabble.com.
Hi, is there any way to set the ylim range from zero to whatever is the max value in that dataset? I am plotting many similar plots to the one below, and would like to avoid having to find the max value each time. plot (D10$Part.P ~ D10$Klorofyll,pch=16,log = "xy", xlab = ("Chla"), ylab ("POP"), ylim = c (0, ???)) abline(m3, untf=TRUE, lty=1,col="blue") text(5, 0.05,paste(round(glm(D10$Part.P ~ D10$Klorofyll, data = D10, family = Gamma(link = "identity"))$coef, 2),collapse = " ")) thank you very much for your time and help. Best regards, Helene Frigstad -- View this message in context: http://old.nabble.com/denoting-max-value-in-ylim-tp26441590p26441590.html Sent from the R help mailing list archive at Nabble.com.
Have you tried max()? i.e. plot (D10$Part.P ~ D10$Klorofyll,pch=16,log = "xy", xlab = ("Chla"), ylab ("POP"), ylim = c (0, max(D10$Klorofyll))) helene frigstad wrote:> > Hi, > > is there any way to set the ylim range from zero to whatever is the max > value in that dataset? I am plotting many similar plots to the one below, > and would like to avoid having to find the max value each time. > > > plot (D10$Part.P ~ D10$Klorofyll,pch=16,log = "xy", xlab = ("Chla"), ylab > = ("POP"), ylim = c (0, ???)) > abline(m3, untf=TRUE, lty=1,col="blue") > text(5, 0.05,paste(round(glm(D10$Part.P ~ D10$Klorofyll, data = D10, > family = Gamma(link = "identity"))$coef, 2),collapse = " ")) > > thank you very much for your time and help. > > Best regards, > Helene Frigstad >-- View this message in context: http://old.nabble.com/denoting-max-value-in-ylim-tp26441589p26441703.html Sent from the R help mailing list archive at Nabble.com.
ylim = c(0, max(log10(D10$Part.P))) Make sure you remove any 0s or NAs before computing the max though. --sundar On Fri, Nov 20, 2009 at 6:12 AM, helene frigstad <helenefrigstad at hotmail.com> wrote:> > Hi, > > is there any way to set the ylim range from zero to whatever is the max > value in that dataset? I am plotting many similar plots to the one below, > and would like to avoid having to find the max value each time. > > > plot (D10$Part.P ~ D10$Klorofyll,pch=16,log = "xy", xlab = ("Chla"), ylab > ("POP"), ylim = c (0, ???)) > ? ? ? ?abline(m3, untf=TRUE, lty=1,col="blue") > ? ? ? ?text(5, 0.05,paste(round(glm(D10$Part.P ~ D10$Klorofyll, data = D10, family > = Gamma(link = ? ? ?"identity"))$coef, 2),collapse = " ")) > > thank you very much for your time and help. > > Best regards, > Helene Frigstad > -- > View this message in context: http://old.nabble.com/denoting-max-value-in-ylim-tp26441590p26441590.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >