How to show axis in 3D

173 次查看(过去 30 天)
Any time I plot in 3D I get a little confused because of aggravated orientation. The main reason is the missing default visualisation of thick axis lines (as far as I know)
That's why I tampered with it myslef, coming up with:
%some plotting
axis([0 1 0 1 0 1])
hold all
quiver3(0,0,-max(zlim),0,0,2*max(zlim),'b','LineWidth',1)
quiver3(0,-max(ylim),0,0,2*max(ylim),0,'b','LineWidth',1)
quiver3(-max(xlim),0,0,2*max(xlim),0,0,'b','LineWidth',1)
text(0,0,max(zlim),'Z','Color','b')
text(0,max(ylim),0,'Y','Color','b')
text(max(xlim),0,0,'X','Color','b')
axis equal
Now regarding my question: Is there an easier way to implement this visualization or optimize my attempt? Even putting it in a script so I can type 'axlines on' or somewhat to handle it easily. Or it's all redundant because it already exist somehow?

采纳的回答

Star Strider
Star Strider 2021-6-26
I am not certain what you are asking.
If you want to see it in ‘true’ 3D, use the view function, and to change the axes LineWidth or GridLineStyle (or both), those (and other) options are also available:
%some plotting
axis([0 1 0 1 0 1])
hold all
quiver3(0,0,-max(zlim),0,0,2*max(zlim),'b','LineWidth',1)
quiver3(0,-max(ylim),0,0,2*max(ylim),0,'b','LineWidth',1)
quiver3(-max(xlim),0,0,2*max(xlim),0,0,'b','LineWidth',1)
text(0,0,max(zlim),'Z','Color','b')
text(0,max(ylim),0,'Y','Color','b')
text(max(xlim),0,0,'X','Color','b')
axis equal
view(30,30)
set(gca, 'LineWidth',2, 'XGrid','on', 'GridLineStyle','--')
.
  2 个评论
Niklas Kurz
Niklas Kurz 2021-6-29
Basically I was asking for an easier way to implement those arrows that I drew inconveniently with quiver. Yor gca-manipulation also is an enhancement to better orientate in 3D-plots

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Vector Fields 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by