convertNative package:grid R Documentation _C_o_n_v_e_r_t _a _U_n_i_t _O_b_j_e_c_t _t_o _N_a_t_i_v_e _u_n_i_t_s _D_e_s_c_r_i_p_t_i_o_n: *This function is deprecated in grid version 0.8 and will be made defunct in grid version 1.9* You should use the 'convertUnit()' function or one of its close allies instead. This function returns a numeric vector containing the specified x or y locations or dimensions, converted to "user" or "data" units, relative to the current viewport. _U_s_a_g_e: convertNative(unit, dimension="x", type="location") _A_r_g_u_m_e_n_t_s: unit: A unit object. dimension: Either "x" or "y". type: Either "location" or "dimension". _V_a_l_u_e: A numeric vector. _W_A_R_N_I_N_G: If you draw objects based on output from these conversion functions, then resize your device, the objects will be drawn incorrectly - the base R display list will not recalculate these conversions. This means that you can only rely on the results of these calculations if the size of your device is fixed. _A_u_t_h_o_r(_s): Paul Murrell _S_e_e _A_l_s_o: 'grid.convert', 'unit' _E_x_a_m_p_l_e_s: grid.newpage() pushViewport(viewport(width=unit(.5, "npc"), height=unit(.5, "npc"))) grid.rect() w <- convertNative(unit(1, "inches")) h <- convertNative(unit(1, "inches"), "y") # This rectangle starts off life as 1in square, but if you # resize the device it will no longer be 1in square grid.rect(width=unit(w, "native"), height=unit(h, "native"), gp=gpar(col="red")) popViewport(1) # How to use grid.convert(), etc instead convertNative(unit(1, "inches")) == convertX(unit(1, "inches"), "native", valueOnly=TRUE) convertNative(unit(1, "inches"), "y", "dimension") == convertHeight(unit(1, "inches"), "native", valueOnly=TRUE)