plot 3D curve with color-coded direction
显示 更早的评论
hi, friends,
I have a 3xN matrix, which represents N points in one curve. I know plot3 can plot this curve easily, but I want to use color to represent the curve orientation. For example, if the curve is in x direction, the color is "red", if the curve is in y direction, the color is in "green", if the curve is in z direction, the color is in "blue“.
So the color will vary with the curve going from the beginning to the end.
I saw some example from other software, want to know whether it can be done in matlab.
Appreciate!
LZ
采纳的回答
更多回答(2 个)
Walter Roberson
2012-7-31
0 个投票
line() and lineseries objects such as are generated by plot() and plot3(), are each restricted to one color along the length. For this reason, some people prefer to instead use very narrow patch() objects; the edgecolor of patch objects can be controlled.
Question: if A, B, C are three consecutive points, with different "trends" between A-B and B-C, then should the line between A-B be all one color, and the line between B-C be all a different color, or do you want the color changes to shade between the points ?
类别
在 帮助中心 和 File Exchange 中查找有关 Surface and Mesh Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!