[R] Changing pch spacing

Henrik Bengtsson hb at maths.lth.se
Thu Oct 31 06:27:37 CET 2002


Argument 'pch' can also be a vector, e.g.

x <- rnorm(1000)
y <- rnorm(1000)

# pch=".", but every k:th is a "1".
k <- 5
pch <- rep(".", length(x))
pch[seq(1,length(x),by=k)] <- "1"

plot(x,y, type="b", pch=pch)


> -----Original Message-----
> From: owner-r-help at stat.math.ethz.ch 
> [mailto:owner-r-help at stat.math.ethz.ch] On Behalf Of Wolfgang 
> Viechtbauer
> Sent: den 31 oktober 2002 13:42
> To: r-help at stat.math.ethz.ch
> Subject: [R] Changing pch spacing
> 
> 
> Hello R-Helpers,
> 
> plot(x, y, type="b", pch="1")
> 
> plots x vs. y with both a line and the symbol "1" but how do 
> I change the "spacing" of the symbol being plotted. In other 
> words, I don't want to plot the "1" at every data point, but 
> only at every kth point (things get too cluttered when there 
> are many data points). Thanks in advance!
> 
> --
> Wolfgang Viechtbauer
> 
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
> -.-.-.-.-.-.-.-.-
> r-help mailing list -- Read 
> http://www.ci.tuwien.ac.at/~hornik/R/R-> FAQ.html
> Send "info", 
> "help", or "[un]subscribe"
> (in the 
> "body", not the subject !)  To: 
> r-help-request at stat.math.ethz.ch 
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
> _._._._._._._._._
> 
> 

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list