How to make invisible only a part of an axis?
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi, I would like to make invisible just a part of an axis. Is it possible? If Yes, how?
(note: figure created by @Adam Danz for this question: How to create a secondary Cartesian coordinate system (three perpendicular coordinate axes) in Matlab?)
0 commentaires
Réponse acceptée
dpb
le 23 Août 2021
Modifié(e) : dpb
le 25 Août 2021
Not really any way piecewise, no. The axis color is one property as is 'Visible' either {'on','off'}
Best could do that I can think of builtin would be to set
xticks([0:0.2:0.6])
that would leave the axis line but eliminate the extra tick labels/ticks.
Only way I can think of to get the full effect would be to set 'Visible','off' for the X axis and then draw the line and ticks manually; doable but a pain.
ADDENDUM:
OK, the following does work although you may need to use a slightly heavier line width than default to avoid a few speckles being left...
hold on
xticks([0:0.2:0.6])
hL3=plot3([0.8 1],[0.5 0.5],[0.5 0.5],'w-');
9 commentaires
dpb
le 25 Août 2021
OBTW, you'll probably have noticed and fixed up your code but I left out the tick step spacing in typing the xticks line above -- fixed in the Answer to
xticks([0:0.2:0.6])
You can, of course, also set the starting point of the line to anywhere along the x axis you wish to get the apparent length as desired. I just chose 0.8 as a guess as to what your original example would have been.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Labels and Annotations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!