

points {base}                                R Documentation

_A_d_d _P_o_i_n_t_s _t_o _a _P_l_o_t

_D_e_s_c_r_i_p_t_i_o_n_:

     `points' is a generic function to draw a sequence of
     points at the specified coordinates.  The specified
     character(s) are plotted, centered at the coordinates.

_U_s_a_g_e_:

     points(x, ...)
     points.default(x, y=NULL, type="p", pch=1, col="black", bg=NA, cex=1, ...)

_A_r_g_u_m_e_n_t_s_:

    x, y: coordinate vectors of points to plot.

    type: character indicating the type of plotting; actu-
          ally any of the `type's as in `plot(..)'.

     pch: plotting `character', i.e. symbol to use.  `pch'
          can either be a `character' or an integer code for
          a set of graphics symbols.  The full set of S sym-
          bols is available with `pch=0:18'.

          In addition, there is a special set of R plotting
          symbols which can be obtained with `pch=19:25' and
          can be colored and filled with different colors:

             * `pch=19': solid circle,

             * `pch=20': bullet,

             * `pch=21': circle,

             * `pch=22': square,

             * `pch=23': diamond,

             * `pch=24': triangle point-up,

             * `pch=25': triangle point down.

     col: color code or name, see `colors', `palette'.

      bg: background (``fill'') color for open plot symbols

     cex: character expansion

     ...: Further graphical parameters (see `plot.xy' and
          `par') may also be supplied as arguments.

_D_e_t_a_i_l_s_:

     Graphical parameters are permitted as arguments to this
     function.

_S_e_e _A_l_s_o_:

     `plot', `lines', and the underlying ``primitive''
     `plot.xy'.

_E_x_a_m_p_l_e_s_:

     plot(-4:4, -4:4, type = "n")# setting up coord. system
     points(rnorm(200), rnorm(200), col = "red")
     points(rnorm(100)/2, rnorm(100)/2, col = "blue", cex = 1.5)

     ##-------- Showing all the extra & some char graphics symbols ------------
     Pex <- 3 ## now (0.90) good for both .Device=="postscript" and "x11"
     ipch <- 1:(np <- 25+11); k <- floor(sqrt(np)); dd <- c(-1,1)/2
     rx <- dd + range(ix <- (ipch-1) %/% k)
     ry <- dd + range(iy <- 3 + (k-1)-(ipch-1) %% k)
     pch <- as.list(ipch)
     pch[25+ 1:11] <- as.list(c("*",".", "o","O","0","+","-",":","|","%","#"))
     plot(rx, ry, type="n", axes = F, xlab = "", ylab = "",
          main = paste("plot symbols :  points (..  pch = *, cex =",Pex,")"))
     abline(v = ix, h = iy, col = "lightgray", lty = "dotted")
     for(i in 1:np) {
       pc <- pch[[i]]
       points(ix[i], iy[i], pch = pc, col = "red", bg = "yellow", cex = Pex)
       ## red symbols with a yellow interior (where available)
       text(ix[i] - .3, iy[i], pc, col = "brown", cex = 1.2)
     }

