Somehow, my text labels are obscured by my large plot markers, like this
figure hold text(0.5, 0.5, 'I''m hidden', 'HorizontalAlignment', 'center'); plot(0.5, 0.5, '.r', 'MarkerSize', 100)
In this example, when I change the order between the text and plot commands (so first plot and then text, it's fine, it works). But somehow in my big cloudy figure, changing the order doesn't work.
Does anybody know how I can put the labels on the big markers, instead of behind?
No products are associated with this question.
This is not the ideal answer, I am sure there's something cleaner but it works. The ordering of the axes children is the issue here.
ax = gca; axes_children = get(ax, 'Children') %the ordering of the array x determines what comes up on top. you want to re-arrange this array, and then re-set the children. new_axes_children(1) = axes_children(2); new_axes_children(2) = axes_children(1); %create a new array with the ordering flipped set(ax, 'Children', new_axes_children);
If I think of something cleaner I'll comment again
Alpha-blending means, that the OpenGL renderer is used. But then the implementation of the text rendering depends on your OpenGL driver and there is no general solution anymore. Sometimes it helps to define the text() with 3 coordinates and care for moving it between the camera and the objects - but this is not trivial when the camera is moved or the view angle is changed etc.
Sometimes it helps to change the EraseMode of the text from 'normal' to 'none'. But this can have surprising other effects, e.g. printing a hardcopy can let Matlab crash.
Play games and win prizes!Learn more