mtext                  package:base                  R Documentation

_W_r_i_t_e _T_e_x_t _i_n_t_o _t_h_e _M_a_r_g_i_n_s _o_f _a _P_l_o_t

_D_e_s_c_r_i_p_t_i_o_n:

     Text is written in one of the four margins of the current figure
     region or one of the outer margins of the device region.

_U_s_a_g_e:

     mtext(text, side = 3, line = 0, outer = FALSE, at = NA,
           adj = NA, cex = NA, col = NA, font = NA, vfont = NULL, ...)

_A_r_g_u_m_e_n_t_s:

    text: one or more character strings or expressions.

    side: on which side of the plot (1=bottom, 2=left, 3=top, 4=right).

    line: on which MARgin line, starting at 0 counting outwards.

   outer: use outer margins if available.

      at: give location in user-coordinates.  If `length(at)==0' (the
          default), the location will be determined by `adj'. 

     adj: adjustment for each string. For strings parallel to the axes,
          `adj=0' means left or bottom alignment, and `adj=1' means
          right or top aligment. If `adj' is not a finite value (the
          default), the value `par("las")' determines the adjustment.
          For strings plotted parallel to the axis the default is to
          centre the string.

     ...: Further graphical parameters (see `text' and `par') ;
          currently supported are:

     cex: character expansion factor (default = 1).

     col: color to use.

    font: font for text.

   vfont: vector font for text.

_D_e_t_a_i_l_s:

     The ``user coordinates'' in the outer margins always range from
     zero to one, and are not affected by the user coordinates in the
     figure region(s) - R is differing here from other implementations
     of S.

     The arguments `side', `line', `at', `at', `adj', the further
     graphical parameters and even `outer' can be vectors, and
     recycling will take place to plot as many strings as the longest
     of the vector arguments.  Note that a vector `adj' has a different
     meaning from `text'.

     `adj = 0.5' will centre the string, but for `outer=TRUE' on the
     device region rather than the plot region.

     Parameter `las' will determine the orientation of the string(s).
     For strings plotted perpendicular to the axis the default
     justifcation is to place the end of the string nearest the axis on
     the specified line.

     Note that if the text is to be plotted perpendicular to the axis,
     `adj' determines the justification of the string and the position
     along the axis unless `at' is specified.

_S_i_d_e _E_f_f_e_c_t_s:

     The given text is written onto the current plot.

_S_e_e _A_l_s_o:

     `title', `text', `plot', `par'; `plotmath' for details on
     mathematical annotation.

_E_x_a_m_p_l_e_s:

     plot(1:10, (-4:5)^2, main="Parabola Points", xlab="xlab")
     mtext("10 of them")
     for(s in 1:4)
         mtext(paste("mtext(..., line= -1, {side, col, font} = ",s,
               ", cex = ", (1+s)/2, ")"), line = -1,
               side=s, col=s, font=s, cex= (1+s)/2)
     mtext("mtext(..., line= -2)", line = -2)
     mtext("mtext(..., line= -2, adj = 0)", line = -2, adj =0)
     ##--- log axis :
     plot(1:10, exp(1:10), log='y', main="log='y'", xlab="xlab")
     for(s in 1:4) mtext(paste("mtext(...,side=",s,")"), side=s)

