Depth Label of 3D Graph (Cylinder)
1 view (last 30 days)
Show older comments
I'm trying to graph a borehole using a set of depths and their respective diameters. I tried graphing it using:
r = [5,7,4,6,8,6,5,5,7,8]; [X,Y,Z]=cylinder(r); Surf(X,Y,X)
Which gave me a graph showing the diameters "r" on the x-y plane, but the z axis is always set to 1 (endpoints 0 to 1). How can I assign depths to each diameter of the graph.
e.g. (Z = [0,1,2,3,4,5,6,7,8,9])
0 Comments
Answers (1)
Benjamin Kraus
on 1 Feb 2018
I would recommend ignoring the Z output from cylinder and just creating your own using meshgrid or ndgrid.
r = [5,7,4,6,8,6,5,5,7,8];
depths = [0,1,2,3,4,5,6,7,8,9];
[X,Y]=cylinder(r');
[~,Z] = meshgrid(1:size(X,2),depths);
[~,C] = meshgrid(1:size(X,2),r); % Color based on radius
surf(X,Y,Z,C)
If the data is upside down, just flip depths before calling meshgrid:
r = [5,7,4,6,8,6,5,5,7,8];
depths = [0,1,2,3,4,5,6,7,8,9];
[X,Y]=cylinder(r');
[~,Z] = meshgrid(1:size(X,2),flip(depths));
surf(X,Y,Z)
0 Comments
See Also
Categories
Find more on Graph and Network Algorithms in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!