How to ensure text on plot always in front?

76 visualizzazioni (ultimi 30 giorni)
Hi all,
I plot some surfaces and label some points on the surface with it's value of z-axis, as shown on the figure. You can see that the black texts on figure 3-4 are all covered by the surfaces. How can I make sure that the black texts are always in front such that they can be seen?
Many thanks!
  4 Commenti
José-Luis
José-Luis il 29 Ago 2017
Also, it might be a rendering issue. Have you tried saving to file and looking there.
Testing different renderers might also help.

Accedi per commentare.

Risposta accettata

Teja Muppirala
Teja Muppirala il 29 Ago 2017
One workaround would be to create an invisible axes on top, and then put the text in there.
figure
ax1 = axes;
mesh(ax1,peaks)
colorbar;
t(1) = text(25,25,1,'My text'); % The text will be obscured by the mesh
t(2) = text(10, 30,-2,'More text');
axHidden = axes('Visible','off','hittest','off'); % Invisible axes
linkprop([ax1 axHidden],{'CameraPosition' 'XLim' 'YLim' 'ZLim' 'Position'}); % The axes should stay aligned
set(t,'Parent',axHidden); % Put the text in the invisible Axes
  2 Commenti
Xiaohan Du
Xiaohan Du il 29 Ago 2017
Hi both,
This is quite complex compare with just making the surfaces transparent, I tried Jose's solution with modifying the Alpha property and it's like this:
I think it's much better.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Visual Exploration in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by