pix2inches              package:iSPlot              R Documentation

_F_u_n_c_t_i_o_n_s _t_o _p_e_r_f_o_r_m _c_o_n_v_e_r_s_i_o_n_s _b_e_t_w_e_e_n _d_i_f_f_e_r_e_n_t _u_n_i_t_s _o_f _m_e_a_s_u_r_e_m_e_n_t

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

     When a user interacts with a plot on a gtk device, the (x,y)
     location  is returned in pixels, but to determine the point on the
     plot, we need  the location to be stated in user coordinates. 
     These functions,  pix2inches and inches2usr, will do the
     conversion between pixels and  inches, and inches and user
     coordinates, respectively.

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

     pix2inches(x, y)
     inches2usr(x, y)
     getPixPerInch()
     devWidthPixels()
     devHeightPixels()
     devPixel()

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

       x: the x location 

       y: the y location 

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

     MMPI is a constant, equal to 25.4.  It is the number of
     millimeters per  inch.

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

     pix2inches and inches2usr both return a list with the following
     items. 

       x: the x location

       y: the y location

     pix2inches returns the (x,y) location in inches and inches2usr
     returns  the (x,y) location in user coordinates.

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

     Robert Gentleman, Elizabeth Whalen

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

     'clickEvent', 'checkPoint'

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

       if (interactive())
       {
         createControlWindow()
         # should load data through Open Data or Open File under the File menu
         data(USArrests)
         loadDFData(USArrests,"USArrests")
         # plotting the data should occur through Plot Data under 
         # the Display menu
         # createView will call setActiveDF
         createView(type = "plotView", dataName = "USArrests", 
                    plotType = "sPlotView", dfRows = 1:nrow(USArrests), 
                    dfColumns = 1:2) 
        
         Sys.sleep(1)
         # just randomly picked x=200 and y=300
         # normally the (x,y) location in pixels would be returned by
         # a gtk callback
         xyinch<-pix2inches(200,300)
         xi<-xyinch[[1]]
         yi<-xyinch[[2]]
         xyusr<-inches2usr(xi,yi)
       }

