axis_screen_angle

axis_screen_angle(ax, line_axis)

AXIS_SCREEN_ANGLE On-screen angle of an axes’ x, y, or z axis direction

Usage:

ang = axis_screen_angle(ax, line_axis)

Inputs:

ax : axes handle (default: gca) line_axis : ‘x’, ‘y’, or ‘z’ - axis direction to measure (default: ‘x’)

Outputs:
angdouble - angle in degrees CCW from screen-horizontal, folded

to (-90, 90] so text with this Rotation reads upright

Notes

Projects the axis direction through the view transform (viewmtx), the plot box aspect ratio, and the axes’ stretch-to-fill pixel scaling (aspect-constrained axes share one scale). Also works for 2-D axes, where x -> 0 and y -> 90.

Example

surf(peaks(30)); view(140, 42); ang = axis_screen_angle(gca, ‘x’);

See also: align_axis_labels, scaleline, viewmtx

∿∿∿ Prerau Laboratory MATLAB Codebase · sleepEEG.org ∿∿∿