[R] plot question
Hi everyone, I have what may appear to be a newbie question, but I have looked everywhere I can think to look and I cannot find an answer. On page 35 of An Introduction to R the following command appears: plot(ecdf(eruptions), do.points=FALSE, verticals=TRUE). What is the do.points argument? I know what it does (suppresses printing of the points) but where can I find help on it? I want to be able to explain it fully to my students. Thanks for your help, Cathy -- Dr. Cathy Carter Department of Geography University of Maryland A LeFrak Hall 301.405.4620 __ R-help@stat.math.ethz.ch 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.
Re: [R] plot question
Take a look at ?plot.stepfun. 'ecdf()' returns an object of class ecdf inheriting from class stepfun and 'plot.ecdf()' calls 'plot.stepfun'. -roger Catherine Carter wrote: Hi everyone, I have what may appear to be a newbie question, but I have looked everywhere I can think to look and I cannot find an answer. On page 35 of An Introduction to R the following command appears: plot(ecdf(eruptions), do.points=FALSE, verticals=TRUE). What is the do.points argument? I know what it does (suppresses printing of the points) but where can I find help on it? I want to be able to explain it fully to my students. Thanks for your help, Cathy -- Roger D. Peng | http://www.biostat.jhsph.edu/~rpeng/ __ R-help@stat.math.ethz.ch 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.
Re: [R] plot question
On Fri, 2006-08-25 at 09:08 -0400, Catherine Carter wrote: Hi everyone, I have what may appear to be a newbie question, but I have looked everywhere I can think to look and I cannot find an answer. On page 35 of An Introduction to R the following command appears: plot(ecdf(eruptions), do.points=FALSE, verticals=TRUE). What is the do.points argument? I know what it does (suppresses printing of the points) but where can I find help on it? I want to be able to explain it fully to my students. Thanks for your help, Cathy A couple of options: 1. If you are aware of how R uses method dispatch, then you might know that the plot() function is a generic method and that plot.ecdf() is the specific method that is called when the initial argument is of class ecdf, as is the case above. Thus, using ?plot.ecdf will get you to the help page, where there is a notation in the Arguments section that the '...' arguments are then passed to plot.stepfun(). 'do.points' is passed in this fashion, so using ?plot.stepfun will then get you to the help page where 'do.points' is defined as: logical; if true, also draw points at the (xlim restricted) knot locations. 2. Using: RSiteSearch(do.points, restrict = functions) will search the online function documentation, bringing up a browser window, where the first link gets you to ?plot.stepfun. HTH, Marc Schwartz __ R-help@stat.math.ethz.ch 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.
Re: [R] plot question
Thank you! That is exactly what I needed. Roger D. Peng wrote: Take a look at ?plot.stepfun. 'ecdf()' returns an object of class ecdf inheriting from class stepfun and 'plot.ecdf()' calls 'plot.stepfun'. -roger Catherine Carter wrote: Hi everyone, I have what may appear to be a newbie question, but I have looked everywhere I can think to look and I cannot find an answer. On page 35 of An Introduction to R the following command appears: plot(ecdf(eruptions), do.points=FALSE, verticals=TRUE). What is the do.points argument? I know what it does (suppresses printing of the points) but where can I find help on it? I want to be able to explain it fully to my students. Thanks for your help, Cathy -- Dr. Cathy Carter Department of Geography University of Maryland A LeFrak Hall 301.405.4620 __ R-help@stat.math.ethz.ch 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.
Re: [R] plot question when type = b and pch is a vector
Dear tokas, How about: x - seq(0.01, 10, length = 20) xx - x[7] x[7] - NA plot(c(0, 10), c(-20, 20), type = n, xlab = x, ylab = expression(2 * alpha * log(x))) for(i in 1:4){ lines(x, 2 * i * log(x), lty = 1) text(xx, 2 * i * log(xx), i) } I hope this helps, John John Fox Department of Sociology McMaster University Hamilton, Ontario Canada L8S 4M4 905-525-9140x23604 http://socserv.mcmaster.ca/jfox -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of toka tokas Sent: Sunday, October 02, 2005 5:37 AM To: r-help@stat.math.ethz.ch Subject: [R] plot question when type = b and pch is a vector Dear R users, I've been struggling some days with the following problem: I'm interesting in producing the following plot x - seq(0.01, 10, length = 20) plot(c(0, 10), c(-20, 20), type = n, xlab = x, ylab = expression(2 * alpha * log(x))) pch. - rep(NA, length(x)) for(i in 1:4){ pch.[7] - as.character(i) lines(x, 2 * i * log(x), type = b, pch = pch., lty = 1) } where all the line segments are connected, except from the 7th one where I've put the value of alpha -- in other words I'd like to produce a line plot where the label appears at each line with some white space around it. thanks in advance, tokas __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] plot question
a.d. I refer you to ?title and its given examples. try this -- plot(rnorm(10),rnorm(10),xlab= ,ylab= ) title(xlab=year, ylab=expression(paste('M x'*10^{3},)),font=2) note that 'title()' will alos accept a list for x and y labs, for additional parameters,e.g., 'col' and 'cex' John a.d wrote--- dear list: in the following plot: plot(rnorm(10),rnorm(10),xlab=year,ylab=expression (paste('M x'*10^{3},)),font.lab=2) font.lab=2, but xlab and ylab are different. I want both labels in the same way. help? a.d. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] plot question
Gabor, I thought that I had worked around the 'expression' format problem, but if the x-y labels are to be bold, then using,say, cex.lab=1.25in the title(), appears to simulate 'bold' font very well, both for the ylab maths expression and xlab text. Your solution is the rigorous one! John for example -- plot(rnorm(10),rnorm(10),xlab= ,ylab= ) title(xlab=year, ylab=expression(paste(M x*10^{3})),font.lab=1,col.lab=4, cex.lab=1.25) Gabor Grothendieck wrote --- Trying characters and expressions variously it seems that font.lab applies to character strings but not to expressions so if you want to use an expression just use bold (or whatever) explicitly on the expression. One gotcha is that bold will not work as one might have expected on numbers so they must be represented as character strings -- which is why we have used 3 rather than 3 below. plot(rnorm(10),rnorm(10),xlab=quote(bold(year)),ylab=quote(bold(Mx10^3)) ) On 7/2/05, alex diaz [EMAIL PROTECTED] wrote: dear list: in the following plot: plot(rnorm(10),rnorm(10),xlab=year,ylab=expression (paste('M x'*10^{3},)),font.lab=2) font.lab=2, but xlab and ylab are different. I want both labels in the same way. help? a.d. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] plot question
At least on Windows XP R 2.1.1 it does seem like there is quite a difference to me, at least when done side by side, which can be seen like this: plot(rnorm(10),rnorm(10),xlab=,ylab=) title(xlab=x,ylab=quote(bold(3*4)),font.lab=1,cex.lab=1.25,col.lab=blue) since the cex.lab will act on both 3 and 4 but bold will only act on the 4 since numbers such as 3 in the example are ignored by bold. Maybe in isolation it would suffice. On 7/3/05, John Wilkinson (pipex) [EMAIL PROTECTED] wrote: Gabor, I thought that I had worked around the 'expression' format problem, but if the x-y labels are to be bold, then using,say, cex.lab=1.25in the title(), appears to simulate 'bold' font very well, both for the ylab maths expression and xlab text. Your solution is the rigorous one! John for example -- plot(rnorm(10),rnorm(10),xlab= ,ylab= ) title(xlab=year, ylab=expression(paste(M x*10^{3})),font.lab=1,col.lab=4, cex.lab=1.25) Gabor Grothendieck wrote --- Trying characters and expressions variously it seems that font.lab applies to character strings but not to expressions so if you want to use an expression just use bold (or whatever) explicitly on the expression. One gotcha is that bold will not work as one might have expected on numbers so they must be represented as character strings -- which is why we have used 3 rather than 3 below. plot(rnorm(10),rnorm(10),xlab=quote(bold(year)),ylab=quote(bold(Mx10^3)) ) On 7/2/05, alex diaz [EMAIL PROTECTED] wrote: dear list: in the following plot: plot(rnorm(10),rnorm(10),xlab=year,ylab=expression (paste('M x'*10^{3},)),font.lab=2) font.lab=2, but xlab and ylab are different. I want both labels in the same way. help? a.d. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] plot question
dear list: in the following plot: plot(rnorm(10),rnorm(10),xlab=year,ylab=expression (paste('M x'*10^{3},)),font.lab=2) font.lab=2, but xlab and ylab are different. I want both labels in the same way. help? a.d. - Email Enviado utilizando o serviço MegaMail __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] plot question
Trying characters and expressions variously it seems that font.lab applies to character strings but not to expressions so if you want to use an expression just use bold (or whatever) explicitly on the expression. One gotcha is that bold will not work as one might have expected on numbers so they must be represented as character strings -- which is why we have used 3 rather than 3 below. plot(rnorm(10),rnorm(10),xlab=quote(bold(year)),ylab=quote(bold(Mx10^3))) On 7/2/05, alex diaz [EMAIL PROTECTED] wrote: dear list: in the following plot: plot(rnorm(10),rnorm(10),xlab=year,ylab=expression (paste('M x'*10^{3},)),font.lab=2) font.lab=2, but xlab and ylab are different. I want both labels in the same way. help? a.d. - Email Enviado utilizando o serviço MegaMail __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] plot question
do you need something like this: par(mfrow=c(2, 2)) plot(0:10, 0:10, axes=FALSE, xlim=c(0, 10)) axis(1, at=seq(0, 10, 5)) axis(2) plot(0:10, 0:10, axes=FALSE, xlim=c(0, 10)) axis(1, at=seq(0, 10, 2)) axis(2) plot(0:10, 0:10, axes=FALSE, xlim=c(0, 10)) axis(1, at=seq(0, 10, 1)) axis(2) I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/16/336899 Fax: +32/16/337015 Web: http://www.med.kuleuven.ac.be/biostat/ http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm - Original Message - From: alexbri [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Thursday, May 19, 2005 1:18 PM Subject: [R] plot question hi all: xlim and ylim are used to define the interval limits of a plot. I'm interested in the scale of values between this limits. suppose xlim=c(0,10) we can have e.g. 0 5 10 0 2 4 6 8 10 0 1 2 3 4 5 6 7 8 9 10 which is the parameter that allows me to modify this? thanks in advance alexandre __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] plot question
thks Dimitris, it helped a lot. alex -Mensagem original- De: Dimitris Rizopoulos [mailto:[EMAIL PROTECTED] Enviada: qui 19-05-2005 12:50 Para: alexbri Cc: r-help@stat.math.ethz.ch Assunto: Re: [R] plot question do you need something like this: par(mfrow=c(2, 2)) plot(0:10, 0:10, axes=FALSE, xlim=c(0, 10)) axis(1, at=seq(0, 10, 5)) axis(2) plot(0:10, 0:10, axes=FALSE, xlim=c(0, 10)) axis(1, at=seq(0, 10, 2)) axis(2) plot(0:10, 0:10, axes=FALSE, xlim=c(0, 10)) axis(1, at=seq(0, 10, 1)) axis(2) I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/16/336899 Fax: +32/16/337015 Web: http://www.med.kuleuven.ac.be/biostat/ http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm - Original Message - From: alexbri [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Thursday, May 19, 2005 1:18 PM Subject: [R] plot question hi all: xlim and ylim are used to define the interval limits of a plot. I'm interested in the scale of values between this limits. suppose xlim=c(0,10) we can have e.g. 0 5 10 0 2 4 6 8 10 0 1 2 3 4 5 6 7 8 9 10 which is the parameter that allows me to modify this? thanks in advance alexandre __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] plot question
I have the following simple situation: tt - data.frame(c(0.5, 1, 0.5)) names(tt) - a plot(tt$a, type = 'o') gives the following plot ('I' and '.' represent the axis): I I I X I I I X X I... 1 2 3 what do I have to change to get the following: I I I X I I I X X I. 1 2 3 i.e. the plot-region should be widened at the left and right side thanks for a hint christoph __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] plot question
On Thu, 2005-03-03 at 17:29 +0100, Christoph Lehmann wrote: I have the following simple situation: tt - data.frame(c(0.5, 1, 0.5)) names(tt) - a plot(tt$a, type = 'o') gives the following plot ('I' and '.' represent the axis): I I I X I I I X X I... 1 2 3 what do I have to change to get the following: I I I X I I I X X I. 1 2 3 i.e. the plot-region should be widened at the left and right side thanks for a hint Use 'xlim' to specify the range of the x axis: plot(c(0.5, 1, 0.5), type = 'o', xlim = c(0, 4)) See ?par for more information. HTH, Marc Schwartz __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] plot question
tt - data.frame(c(0.5, 1, 0.5)) names(tt) - a plot(tt$a, type = 'o',xlim=c(0,4)) __ James HoltmanWhat is the problem you are trying to solve? Executive Technical Consultant -- Office of Technology, Convergys [EMAIL PROTECTED] +1 (513) 723-2929 Christoph Lehmann [EMAIL PROTECTED]To: r-help@stat.math.ethz.ch x.chcc: Sent by: Subject: [R] plot question [EMAIL PROTECTED] ath.ethz.ch 03/03/2005 11:29 I have the following simple situation: tt - data.frame(c(0.5, 1, 0.5)) names(tt) - a plot(tt$a, type = 'o') gives the following plot ('I' and '.' represent the axis): I I I X I I I X X I... 1 2 3 what do I have to change to get the following: I I I X I I I X X I. 1 2 3 i.e. the plot-region should be widened at the left and right side thanks for a hint christoph __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] plot question
On Thu, 2005-03-03 at 10:44 -0600, Marc Schwartz wrote: See ?par for more information. Correction, that should have been ?plot.default for more information, though ?par has other relevant information on plot parameters as well. Marc __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] plot question
On Mar 3, 2005, at 5:29 PM, Christoph Lehmann wrote: I have the following simple situation: tt - data.frame(c(0.5, 1, 0.5)) names(tt) - a plot(tt$a, type = 'o') gives the following plot ('I' and '.' represent the axis): I I I X I I I X X I... 1 2 3 what do I have to change to get the following: I I I X I I I X X I. 1 2 3 i.e. the plot-region should be widened at the left and right side What about: plot(tt$a, type = 'o',xlim=c(0,4)) HTH Remo __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] plot question
Say y and z are two time series (functions of date). What is the R command to plot y and z together on a graph with date on the x-axis? DISCLAIMER: This e-mail message and any attachments are inte...{{dropped}} __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] plot question
Apoian, Zack Zack.Apoian at sac.com writes: Say y and z are two time series (functions of date). What is the R command to plot y and z together on a graph with date on the x-axis? There are several time series classes (ts, zoo in zoo, irts in tseries, its in its, timeDate in fBasics) and its also possible to plot a numeric vector against a vector of dates. Here is an example using zoo which also illustrates the case where the times are not the same: library(zoo) # -- test data -- # y is over today and next 4 days. # z over today and next 9 days. y - zoo(11:15, Sys.Date() + 0:4) z - zoo(21:30, Sys.Date() + 0:9) plot(merge(y,z), plot.type = single, ylim = range(c(y,z)), col = c(green, red)) __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] plot question
I have a variable named Medicine which has seven values in date format, on the following plot, how can I use a red line to indicate the time when the medicine was taken on x axis? The following is my original plot of blood pressure vs. time. plot(time, bloodpressure,xlab=Time,ylab=bPress,main=Time VS Blood Pressure, type=l, xaxt=n) r - as.POSIXct(round(range(Time), days)) axis.POSIXct(1, at=seq(r[1], r[2], by=day), format=%d-%b) Thanks a lot! - [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] plot question
plot(1:10) abline(v=c(3,5,7), col=red) Linda portman lindaportman at yahoo.com writes: : : I have a variable named Medicine which has seven values in date format, on the following plot, how can I use : a red line to indicate the time when the medicine was taken on x axis? : : The following is my original plot of blood pressure vs. time. : plot(time, bloodpressure,xlab=Time,ylab=bPress,main=Time VS Blood Pressure, type=l, xaxt=n) : r - as.POSIXct(round(range(Time), days)) : axis.POSIXct(1, at=seq(r[1], r[2], by=day), format=%d-%b) : : Thanks a lot! __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html