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.
|
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.