3D scale bar for mesh/surf?
Mostra commenti meno recenti
I can't seem to find s scale-bar-making function in MATLAB. I need it for a mesh that I made with dimensions in millimeters. Can anyone help me with this please? I want it to be something like this:

Risposte (1)
Mike Garrity
il 15 Apr 2015
Modificato: Mike Garrity
il 15 Apr 2015
You could start with something like this:
function scalebar(xc,yc,zc, w, label)
x = [xc, xc-w, nan, xc, xc , nan, xc, xc ];
y = [yc, yc , nan, yc, yc-w, nan, yc, yc ];
z = [zc, zc , nan, zc, zc , nan, zc, zc+w];
hl = line(x,y,z);
hl.LineWidth = 2;
ht = text(xc,yc,zc,[num2str(w), ' ', units]);
ht.FontSize = 18;
ht.Color = hl.Color;
ht.VerticalAlignment = 'bottom';
The nans are to insert breaks in between the individual line segments.
I can use it like this:
[x,y,z]=peaks;
surf(x,y,z)
scalebar(-.1,1.4,8.5, 2, 'Feet')
to get this:

%
Categorie
Scopri di più su Discrete Data Plots in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!