C-PLOT

Scientific Graphics and Data Analysis

E.1.5. - Plot and page window coordinates



The coordinates of the plot window are available in both internal and data units. You might use the internal units to obtain the aspect ratio of the plot window, useful, for example, if you are writing a user function to generate data points to draw arrows.

The macros only provide the page-size coordinates in internal units. The corresponding data-unit values can be readily obtained using ratios with the values for the plot window coordinates.

None of the values for these coordinates can be changed within a user function. The values for the plot window coordinates are changed with the wi command within the plot program. The page-window coordinates may change only if other than the default HP-GL plotter is initialized with the in command.

 Name   What it Does 
 get_dx0()   Plot-window x minimum in data units 
 get_dy0()   Plot-window y minimum in data units 
 get_dz0()   Plot-window z minimum in data units 
 get_dx1()   Plot-window x maximum in data units 
 get_dy1()   Plot-window y maximum in data units 
 get_dz1()   Plot-window z minimum in data units 
 get_xdel()   Plot window x range in data units 
 get_ydel()   Plot window y range in data units 
 get_zdel()   Plot window z range in data units 
 get_wx0()   Plot-window x minimum in internal units 
 get_wy0()   Plot-window y minimum in internal units 
 get_wx1()   Plot-window x maximum in internal units 
 get_wy1()   Plot-window y maximum in internal units 
 get_px0()   Page-window x minimum in internal units 
 get_py0()   Page-window y minimum in internal units 
 get_px1()   Page-window x maximum in internal units 
 get_py1()   Page-window y maximum in internal units 

The following sample code generates data coordinates x and y associated with arbitrary internal unit coordinates cx and cy, taking into account whether the plot window is in portrait or landscape mode and whether or not the axes are using logarithmic scaling. Such a transformation would be useful when writing a user function that moves cross hairs over a screen containing a plot drawn by a C-PLOT filter.
if (is_tu()) {
    x = get_dx0() + get_xdel() * (cy - get_wy0()) / (get_wy1() - get_wy0());
    y = get_dy0() + get_ydel() * (get_wx1() - cx) / (get_wx1() - get_wx0());
} else {
    x = get_dx0() + get_xdel() * (cx - get_wx0()) / (get_wx1() - get_wx0());
    y = get_dy0() + get_ydel() * (cy - get_wy(0)) / (get_wy1() - get_wy0());
}
if (is_xlog())
    x = pow(10., x);
if (is_ylog())
    y = pow(10., y);
If the range-changing macros are used to modify the range values within a user function, the above macros will continue to report the original values of the plot window data coordinates until the function is reinvoked after returning to the plot program.