Why does "copyobj" not copy the surface plot which is a child of the axes as expected?
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
MathWorks Support Team
am 4 Jul. 2022
Beantwortet: MathWorks Support Team
am 4 Jul. 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.
Akzeptierte Antwort
MathWorks Support Team
am 4 Jul. 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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Graphics Object Programming finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!