Scatter plot text behind plotted data when image copied.
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Kirstie Beugger
el 2 de Mayo de 2024
Comentada: Adam Danz
el 6 de Mayo de 2024
I have a figure containing a scatter plot overlaid with a fitted poly. I have added some text labels to the data.
When I copy the image and paste as enhanced metafile, the text appears behind the plotted data, even when I set the text object to 'top' and/or set the current axes to 'top':
t = text(x, y, str); % Adding a text label
uistack(t, 'top'); % Bring the text to the front
set(gca, 'Layer', 'top');
If I change the renderer to 'opengl', the image copies correctly, but the pasted image quality is very poor.
This behaviour is repeatable on any figure of this type.
2 comentarios
Respuesta aceptada
Adam Danz
el 2 de Mayo de 2024
Editada: Adam Danz
el 6 de Mayo de 2024
When copying graphics in vector format the figure's renderer is switched to painters which causes the change in text position.
A workaround is to set the z coordinate of the text to a value greater than 0.
tobj = findobj(gca,'type','text');
for i = 1:numel(tobj)
tobj(i).Position(3) = 1;
end
3 comentarios
Adam Danz
el 6 de Mayo de 2024
Thanks for correcting that, Kirstie. Forgot the numel(). I fixed my answer.
Más respuestas (0)
Ver también
Categorías
Más información sobre Annotations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!