How to show axis in 3D

210 vues (au cours des 30 derniers jours)
Niklas Kurz
Niklas Kurz le 26 Juin 2021
Commenté : Star Strider le 29 Juin 2021
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?

Réponse acceptée

Star Strider
Star Strider le 26 Juin 2021
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 commentaires
Niklas Kurz
Niklas Kurz le 29 Juin 2021
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
Star Strider
Star Strider le 29 Juin 2021
Thank you!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Vector Fields dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by