How to show axis in 3D

219 Ansichten (letzte 30 Tage)
Niklas Kurz
Niklas Kurz am 26 Jun. 2021
Kommentiert: Star Strider am 29 Jun. 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?

Akzeptierte Antwort

Star Strider
Star Strider am 26 Jun. 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 Kommentare
Niklas Kurz
Niklas Kurz am 29 Jun. 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 am 29 Jun. 2021
Thank you!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Vector Fields finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by