Greetings all, I have two logistic plots coming from two calls to plogis. The code is .x <- seq(-7.6, 7.6, length=100) plot(.x, plogis(.x, location=0, scale=1), xlab="x", ylab="Density", main="Logistic Distribution: location = 0, scale = 1", type="l") abline(h=0, col="gray") .y <- seq(-7.6, 7.6, length=100) plot(.x, plogis(.x, location=2, scale=4), xlab="x", ylab="Density", main="Logistic Distribution: location = 2, scale = 4", type="l") abline(h=0, col="gray") remove(.x) remove(.y) I would like to overlay these on one plot. Notice here the y-axis is different. But I would like to axis to be 0 to 1 as in the first plot. Any suggestions would be greatly appreciated. Thanks in advance, David -- ======================================================================David Kaplan, Ph.D. Professor Department of Educational Psychology University of Wisconsin - Madison Educational Sciences, Room, 1061 1025 W. Johnson Street Madison, WI 53706 email: dkaplan at education.wisc.edu homepage: http://www.education.wisc.edu/edpsych/default.aspx?content=kaplan.html Phone: 608-262-0836
You could change the second 'plot' to 'points' David Freedman David Kaplan-2 wrote:> > Greetings all, > > I have two logistic plots coming from two calls to plogis. The code is > > .x <- seq(-7.6, 7.6, length=100) > plot(.x, plogis(.x, location=0, scale=1), xlab="x", ylab="Density", > main="Logistic Distribution: location = 0, scale = 1", type="l") > abline(h=0, col="gray") > > > .y <- seq(-7.6, 7.6, length=100) > plot(.x, plogis(.x, location=2, scale=4), xlab="x", ylab="Density", > main="Logistic Distribution: location = 2, scale = 4", type="l") > abline(h=0, col="gray") > > remove(.x) > > remove(.y) > > > I would like to overlay these on one plot. Notice here the y-axis is > different. But I would like to axis to be 0 to 1 as in the first plot. > > Any suggestions would be greatly appreciated. > > Thanks in advance, > > David > > > -- > ======================================================================> David Kaplan, Ph.D. > Professor > Department of Educational Psychology > University of Wisconsin - Madison > Educational Sciences, Room, 1061 > 1025 W. Johnson Street > Madison, WI 53706 > > email: dkaplan at education.wisc.edu > homepage: > http://www.education.wisc.edu/edpsych/default.aspx?content=kaplan.html > Phone: 608-262-0836 > > ______________________________________________ > 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. > >-- View this message in context: http://www.nabble.com/overlay-plot-question-tp21841060p21843564.html Sent from the R help mailing list archive at Nabble.com.
Did you want something like this: library(lattice) x <- plogis(.x, location=0, scale=1) y <- plogis(.x, location=2, scale=4) xvals <- seq(-7.6, 7.6, length=100) xyplot(x+y ~ xvals, type = c("g", "l"))> -----Original Message----- > From: r-help-bounces at r-project.org > [mailto:r-help-bounces at r-project.org] On Behalf Of David Kaplan > Sent: Wednesday, February 04, 2009 5:25 PM > To: r-help at stat.math.ethz.ch > Subject: [R] overlay plot question > > Greetings all, > > I have two logistic plots coming from two calls to plogis. > The code is > > .x <- seq(-7.6, 7.6, length=100) > plot(.x, plogis(.x, location=0, scale=1), xlab="x", > ylab="Density", main="Logistic Distribution: location = 0, > scale = 1", type="l") > abline(h=0, col="gray") > > > .y <- seq(-7.6, 7.6, length=100) > plot(.x, plogis(.x, location=2, scale=4), xlab="x", ylab="Density", > main="Logistic Distribution: location = 2, scale = 4", > type="l") abline(h=0, col="gray") > > remove(.x) > > remove(.y) > > > I would like to overlay these on one plot. Notice here the > y-axis is different. But I would like to axis to be 0 to 1 > as in the first plot. > > Any suggestions would be greatly appreciated. > > Thanks in advance, > > David > > > -- > =============================================================> ========> David Kaplan, Ph.D. > Professor > Department of Educational Psychology > University of Wisconsin - Madison > Educational Sciences, Room, 1061 > 1025 W. Johnson Street > Madison, WI 53706 > > email: dkaplan at education.wisc.edu > homepage: > http://www.education.wisc.edu/edpsych/default.aspx?content=kaplan.html > Phone: 608-262-0836 > > ______________________________________________ > 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. >