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))

