[R] plot symbol "+", but with variable bar lenghts

Jan van der Laan rhelp at eoos.dds.nl
Fri Sep 10 00:23:12 CEST 2010


You can also plot the +'s yourself using for example matlines:

# Some data
x <- 1:10
y <- 1:10

# Height and width of the crosses
dx1 <- 0.1 # width in negative x-direction
dx2 <- 0.2 # width in positive x-direction
dy1 <- 0.2 # height in negative y-direction
dy2 <- 0.3 # height in positive y-direction

# Plot the data
plot(x, y, type='n')
matlines(rbind(c(x-dx1,x), c(x+dx2,x)), rbind(c(y,y-dy1), c(y,y+dy2)), 
lty=1, col="black")

You could quite easily create a function for this.

Jan


On 09/09/2010 04:05 PM, Greg Snow wrote:
> Look at my.symbols in the TeachingDemos package.
>
> -----Original Message-----
> From: Rainer Machne<raim at tbi.univie.ac.at>
> Sent: Thursday, September 09, 2010 12:42 AM
> To: R-help at r-project.org<R-help at r-project.org>
> Subject: [R] plot symbol "+", but with variable bar lenghts
>
>
> Hi,
>
> does anybody know of some plotting function or an easy way to
> generate "+" symbols with individually settable bar lengths?
> I tried just combining "|" and "-" as pch and setting the size via cex,
> but that doesn't really work since the two symbols have different default
> lengths. Is there a horizontal | or a longer "-" available?
>
> Thanks,
> Rainer
>
> ______________________________________________
> 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.
>
> ______________________________________________
> 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.
>



More information about the R-help mailing list