lines                package:graphics                R Documentation

_A_d_d _C_o_n_n_e_c_t_e_d _L_i_n_e _S_e_g_m_e_n_t_s _t_o _a _P_l_o_t

_D_e_s_c_r_i_p_t_i_o_n:

     A generic function taking coordinates given in various ways and
     joining the corresponding points with line segments.

_U_s_a_g_e:

     lines(x, ...)

     ## Default S3 method:
     lines(x, y = NULL, type = "l", ...)

_A_r_g_u_m_e_n_t_s:

    x, y: coordinate vectors of points to join.

    type: character indicating the type of plotting; actually any of
          the 'type's as in 'plot.default'.

     ...: Further graphical parameters (see 'par') may also be supplied
          as arguments, particularly, line type, 'lty', line width,
          'lwd', color, 'col' and for 'type = "b"', 'pch'.  Also the
          line characteristics 'lend', 'ljoin' and 'lmitre'.

_D_e_t_a_i_l_s:

     The coordinates can be passed in a plotting structure (a list with
     'x' and 'y' components), a two-column matrix, a time series, .... 
     See 'xy.coords'.  If supplied separately, they must be of the same
     length.

     The coordinates can contain 'NA' values. If a point contains 'NA'
     in either its 'x' or 'y' value, it is omitted from the plot, and
     lines are not drawn to or from such points.  Thus missing values
     can be used to achieve breaks in lines.

     For 'type = "h"', 'col' can be a vector and will be recycled as
     needed.

     'lwd' can be a vector: its first element will apply to lines but
     the whole vector to symbols (recycled as necessary).

_R_e_f_e_r_e_n_c_e_s:

     Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) _The New S
     Language_. Wadsworth & Brooks/Cole.

_S_e_e _A_l_s_o:

     'points', particularly for 'type %in% c("p","b","o")', 'plot', and
     the workhorse function 'plot.xy'.

     'abline' for drawing (single) straight lines.

     'par' for how to specify colors.

_E_x_a_m_p_l_e_s:

     # draw a smooth line through a scatter plot
     plot(cars, main="Stopping Distance versus Speed")
     lines(stats::lowess(cars))

