[R] plot character

Barry Rowlingson B.Rowlingson at lancaster.ac.uk
Tue Jul 22 19:10:05 CEST 2003


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




More information about the R-help mailing list