spreadout              package:plotrix              R Documentation

_S_p_r_e_a_d _o_u_t _a _v_e_c_t_o_r _o_f _n_u_m_b_e_r_s _t_o _a _m_i_n_i_m_u_m _i_n_t_e_r_v_a_l.

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

     Spread out a vector of numbers so that there is a minimum interval
     between any two numbers when in ascending or descending order.

_U_s_a_g_e:

      spreadout(x,mindist)

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

       x: A numeric vector which may contain NAs.

 mindist: The minimum interval between any two values when in ascending
          or descending order.

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

     'spreadout' starts at or near the middle of the vector and
     increases the intervals between the ordered values. NAs are
     preserved. 'spreadout' first tries to spread groups of values with
     intervals less than 'mindist' out neatly away from the mean of the
     group. If this doesn't entirely succeed, a second pass that forces
     values away from the middle is performed.

     'spreadout' is currently used to avoid overplotting of axis tick
     labels where they may be close together.

_V_a_l_u_e:

     On success, the spread out values. If there are less than two
     valid values, the original vector is returned.

_A_u_t_h_o_r(_s):

     Jim Lemon

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

      spreadout(c(1,3,3,3,3,5),0.2)
      spreadout(c(1,2.5,2.5,3.5,3.5,5),0.2)
      spreadout(c(5,2.5,2.5,NA,3.5,1,3.5,NA),0.2)
      # this will almost always invoke the brute force second pass
      spreadout(rnorm(10),0.5)

