Dear helpers Is it possible to plot with a desired character? For example "tr" for training error and "te" for test error. I tried plot(x,y,pch="tr") but only appears "t" in the plot
Luis Miguel Almeida da Silva wrote:> Dear helpers > > Is it possible to plot with a desired character? For example "tr" for training error and "te" for test error. > I tried > > plot(x,y,pch="tr") > > but only appears "t" in the plot >You probably want to use the 'text' function, but you have to set up the plot first, since 'text' adds to plots. EG: plot(c(0,1),c(0,1),type='n') text(runif(10),runif(10),'Random') The text is by default centered on the x,y location, but you can change this with the adj parameter. The text can be a vector, and it is recycled to the length of x,y: text(runif(10),runif(10),c('Foo','Bar')) see help(text) for more. Baz
Use text(). x <- rnorm(10); y <- rnorm(10) plot(x,y,type="n") text(x,y,rep(c("te","tr"),each=5)) Cheers, Jerome On July 22, 2003 09:59 am, Luis Miguel Almeida da Silva wrote:> Dear helpers > > Is it possible to plot with a desired character? For example "tr" for > training error and "te" for test error. I tried > > plot(x,y,pch="tr") > > but only appears "t" in the plot > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help
On Tue, 2003-07-22 at 11:59, Luis Miguel Almeida da Silva wrote:> Dear helpers > > Is it possible to plot with a desired character? For example "tr" for training error and "te" for test error. > I tried > > plot(x,y,pch="tr") > > but only appears "t" in the plotOne option is to use text(x, y, "TextSymbol") for your point symbols. This will by default place the "TextSymbol" in the plot region centered on x,y. You would first call: plot(x, y, type = "n") so that no points are plotted. Then use: text(x, y, "tr") and text(x, y, "te") for each set of x,y coordinates as appropriate. You can use the 'cex' argument to text() to adjust text size and of course others for color, etc. HTH, Marc Schwartz
Have you considered "?text"? hope this helps. spencer graves Luis Miguel Almeida da Silva wrote:> Dear helpers > > Is it possible to plot with a desired character? For example "tr" for training error and "te" for test error. > I tried > > plot(x,y,pch="tr") > > but only appears "t" in the plot > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help
On Tue, 22 Jul 2003 17:59:24 +0100, "Luis Miguel Almeida da Silva" <lsilva at fc.up.pt> wrote :>Dear helpers > >Is it possible to plot with a desired character? For example "tr" for training error and "te" for test error. >I tried > >plot(x,y,pch="tr") > >but only appears "t" in the plotUse text() instead: plot(x, y, type='n') text(x, y, "tr") The first line sets up the axes, etc; the second one actually plots the strings. You can plot a whole character vector of different values if you like. Duncan Murdoch