How to “color” the first curve moving across x-axis in a 3D surface plot?
1 回表示 (過去 30 日間)
古いコメントを表示
Hi there! I’d like to “color” the first curve in my 3D surface plot differently from the colormap colors, say, black, to contrast nicely with the “cool” colormap colors. How can I best do this? Namely, I want to underlay the surface with a plot3( ) line plot, then find that first curve, then make it black. I was able to do this, writing set(h1(1),‘k’), but the wrong curve gets colored: the first curve going towards the y-axis, when I want to color the curve moving across the x-axis. Thanks in advance.
0 件のコメント
採用された回答
Animesh
2025 年 1 月 4 日
編集済み: Animesh
2025 年 1 月 4 日
Hey @Noob
It seems that you want to color the first curve along the "x-axis" in a 3D surface plot. Here is something you can try:
1. Plot the Surface: Use "surf(X, Y, Z)" to create your surface plot with the desired colormap.
2. Extract the Desired Curve: To get the curve along the "x-axis" (first row of Y), extract the first row of your matrices:
x_curve = X(1, :);
y_curve = Y(1, :);
z_curve = Z(1, :);
3. Overlay the Curve: Use "plot3" to overlay the extracted curve in black:
hold on;
plot3(x_curve, y_curve, z_curve, 'k', 'LineWidth', 2); % Black line with desired thickness
shading interp
hold off;
You can refer to the following MathWorks documentation for more information on "plot3" function:
その他の回答 (0 件)
参考
カテゴリ
Help Center および 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!