Why does "copyobj" not copy the surface plot which is a child of the axes as expected?
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
MathWorks Support Team
el 4 de Jul. de 2022
Respondida: MathWorks Support Team
el 4 de Jul. de 2022
I want to copy an object (axes) to a figure. The surface plot, which is a child of the axes, does not look the same. The colours are different. The colours of the copy look darker.
Respuesta aceptada
MathWorks Support Team
el 4 de Jul. de 2022
The figure provided in the MAT file has set the option 'GraphicsSmoothing' to 'off' and the default is 'on':
a = open('testfigTS.mat');
f1 = a.example_fig;
f1.GraphicsSmoothing
f2 = figure;
f2.GraphicsSmoothing
When we copy the axes over to f2 and set the position to be the same, the color appears different:
ax2 = copyobj(f1.Children,f2);
f2.Position = f1.Position;
However, when we set the 'GraphicsSmoothing' to be the same value, the two will now appear identical:
f2.GraphicsSmoothing = f1.GraphicsSmoothing;
Here is the corresponding documentation that shows the effects of this property:
https://www.mathworks.com/help/matlab/creating_plots/using-graphics-smoothing.html
"copyobj" will copy over the axes and all the properties should be identical but it will not impact anything about the container. In this case, the figure, f2, remains unchanged if anything about the original figure is different from the default.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Graphics Object Programming 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!