space                 package:gplots                 R Documentation

_S_p_a_c_e _p_o_i_n_t_s _i_n _a_n _x-_y _p_l_o_t _s_o _t_h_e_y _d_o_n'_t _o_v_e_r_l_a_p.

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

     Space points in an x-y plot so they don't overlap.

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

     space(x, y, s=1/50, na.rm=TRUE, direction="x")

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

       x: numeric vector of x coordonates.

       y: numeric vector of x coordonates.

       s: either a single numeric value or 2 element vector specifying
          the minimum distance between points in the x and y dimensions
          as a fraction of the x and y range.  Defaults to 1/50.

   na.rm: logical indicating whether pairs where one or both elements
          are missing should be removed.  Defaults to TRUE.

direction: "x" or "y", indicating which direction points should be
          moved to accomplish spacine.

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

     In an x-y plot where at least one variable has discrete levels
     several points may be plotted at or very near the same
     coordonates. This makes it difficult to guage the number of points
     in a specific region.  A common method of resolving this problem
     is to 'jitter' the points by adding random noise.

     This function takes a different approach to the same problem.  

     When there are two or more points with the same (x,y) value (or
     within x+-s[1] and x+-s[2]), it spaces these out in the x
     direction so that the points are separated by at least distance s.

     Another method for dealing with overploting is available in the
     'sunflowerplot' function.

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

     list with two components 

       x: (modified) x location for each input point

       y: y location of each input point

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

     Gregory R. Warnes warnes@bst.rochester.edu

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

     'jitter', 'link'[base]{sunflowerplot}

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

        x <- rep(1:5, 10)
        y <- round(rnorm(length(x),x))

        prepar <- par("mfrow")
        par(mfrow=c(1,3))

        # standard x-y plot: noverlapping points are hidden
        plot(x,y)
        title("Standard Plot") 

        # 'spaced' plot: overlapping points are spread out and visible
        plot(space(x,y))
        title("Plot with 'space'")

        # 'spaced' plot: overlapping points are spread out along y and visible
        plot(space(x,y, direction='y'))
        title("Plot with 'space', direction='y' ")

        # 'sunflower' plot, another approach, overlapping points are
        # indicated via petals
        sunflowerplot(x,y)
        title("Sunflower Plot")

        

        par(mfrow=prepar)

