ThreeVector
This class draws three vectors in the lower, left corner of an axis which indicate the orientation of the x, y, and z axes using a three pronged symbol. The ends of the vectors are labeled according to the axis xlabel, ylabel, zlabel. It installs callback methods to update these axes vectors when the plot is zoomed, rotated, panned, or resized. It also updates the vector labels when xlabel, ylabel, zlabel are set, or xlim, ylim, or zlim are changed. ThreeVector also deals gracefully with figure save and load by appropriately finding and updating internal graphics objects handles on load.
Usage:
tv = ThreeVector()
install for current axis
tv = ThreeVector(axh)
install for specific axis. if already installed,
returns the handle to the previously installed instance after
calling update()
tv.update()
force an update on the axis associated with tv
ThreeVector.updateFigure(figh [== gcf])
update all axes with ThreeVector installed within figure figh.
ThreeVector.updateAxes(axh [== gca])
update axis axh if ThreeVector installed
ThreeVector.demo()
plot a demo surface and install ThreeVector
Properties: setting these will automatically result in an update()
fontSize : font size used for axis labels, defaults to get(axh, 'FontSize')
fontColor : 3 x 1 color vector or plot-color-string (e.g. 'k')
used to label axes, defaults to 0.1 gray
lineWidth : line width used for axis vectors
lineColor : 3 x 1 color vector or plot-color-string (e.g. 'k') for
axis vector lines, defaults to 0.4 gray
vectorLength : scalar length of all axis vectors in cm
textVectorNormalizedPosition : position of axis labels along vectors
in units normalized to the vector length. E.g. 1 is end of vector,
0.5 is halfway along vector, 1.5 is 1.5 times the length of the vector.
axisInset: 2 x 1 vector of offsets in cm from bottom left corner.
in the form [offsetFromLeft, offsetFromBottom]
Author: Dan O'Shea, {my first name} AT djoshea.com (c) 2014
NOTE: This class graciously utilizes code from the following authors:
MinLong Kwong: For computing the data to figure space coordinate transformation matrix.
http://www.mathworks.com/matlabcentral/fileexchange/43896
Malcolm Lidierth: For the isMultipleCall utility to prevent callback re-entrancy
http://undocumentedmatlab.com/blog/controlling-callback-re-entrancy/
Cite As
Daniel J O'Shea (2024). ThreeVector (https://www.mathworks.com/matlabcentral/fileexchange/46062-threevector), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
- MATLAB > Graphics > 2-D and 3-D Plots > Surfaces, Volumes, and Polygons > Volume Visualization > Vector Volume Data >
Tags
Acknowledgements
Inspired by: MUtilities, 3D data space coordinates to normalized figure coordinates conversion
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Version | Published | Release Notes | |
---|---|---|---|
1.0.0.0 |