How to add x labels, y labels, z label and title to a surface plot

124 ビュー (過去 30 日間)
Patrick Smith
Patrick Smith 2019 年 10 月 9 日
編集済み: Sulaymon Eshkabilov 2019 年 10 月 9 日
Hey yall,
I have created a 3D surface plot and I am wondering how can I put labels on the axises? Please help. Below you will find my code.
x = [18 19 20 20 20 20 20 21 21 21 21 35 35 36 37 37 37 37 38 38 38 38 55 55 56 56 56 57 57 57 57 57 58 76 76 76 77 77 77 77 77 77 78 95 95 95 95 96 96 96 97 97 98 98 137 137 138 139 139 139 139 140 140 140 140 178 178 179 179 180 180 180 180 180 181 181 ];
y = [180 0 10 110 120 140 160 30 50 70 90 160 180 110 0 70 90 140 10 30 50 120 140 180 90 120 160 10 30 50 70 110 0 140 160 180 0 30 50 70 90 110 120 120 140 160 180 70 90 110 0 30 10 50 0 10 30 50 70 120 140 90 110 160 180 50 70 30 140 0 10 90 110 120 160 180 ];
z = [9 9 9 9 9 9 9 9 9 9 9 8 8 8 8 8 8 8 8 8 8 8 7 7 7 7 7 7 7 7 7 7 7 6 6 6 6 6 6 6 6 6 6 5 5 5 5 5 5 5 5 5 5 5 3 3 3 3 3 3 3 3 3 3 3 1 1 1 1 1 1 1 1 1 1 1 ];
xx = linspace(min(x),max(x),20);
yy = linspace(min(y),max(y),20);
[X,Y] = meshgrid(xx,yy);
Z = griddata(x,y,z,X,Y);
surf(X,Y,Z, 'edgecolor', 'none')

採用された回答

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2019 年 10 月 9 日
編集済み: Sulaymon Eshkabilov 2019 年 10 月 9 日
Just simple as:
xlabel('X'), ylabel('Y'), zlabel('Z')
Or you can add some notes
xlabel('xx notes'), ylabel('yy notes'), zlabel('Z notes')
  1 件のコメント
Patrick Smith
Patrick Smith 2019 年 10 月 9 日
What about the title? And which line in the code should I put it?

サインインしてコメントする。

その他の回答 (1 件)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2019 年 10 月 9 日
編集済み: Sulaymon Eshkabilov 2019 年 10 月 9 日
title('My plot 3D ....')
all of them can be put at the end of your code.
Good luck.

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by