Hi @Jason,
I've looked into the legend and color issues you're having when copying plots from UIAxes3 to a new figure, and here's what I found from the MathWorks documentation. The main problem with your legend error is that starting from MATLAB R2014b, legends and colorbars must be copied together with their associated axes as a vector input to copyobj
https://www.mathworks.com/help/matlab/ref/copyobj.html
so instead of trying to assign the legend directly with ax2.Legend=L1, you need to use copyobj([ax1.Children, ax1.Legend], ax2) which copies both the plot children and the legend together in one operation. Your second approach where you created a new legend using lgd=legend(ax2,L1s) was on the right track, but the TextColor issue you're seeing where it shows white then black is likely because MATLAB has automatic property modes that can override manual settings when legend properties inherit from the parent axes
https://www.mathworks.com/help/matlab/ref/matlab.graphics.illustration.legend-properties.html,
so after setting lgd.TextColor=L1.TextColor, try adding a drawnow command to force the graphics system to update immediately, or you might need to explicitly set all the legend's appearance properties including FontSize, Location, and other formatting in one go. Regarding the plot colors not being retained by copyobj, the colors should actually be preserved since they're stored in the line objects themselves rather than as axes properties, so when you added 'Color' to your propsToCopy list, that was actually copying the axes background color rather than the line colors. The line colors are properties of each individual line object in ax1.Children, so if the colors aren't appearing correctly, you can iterate through the children and manually copy them with something like for i=1:length(ax2.Children), ax2.Children(i).Color=ax1.Children(i).Color, end, keeping in mind that copyobj can reverse the order of objects so you might need to flip the indices. The most reliable solution would be to use copyobj([ax1.Children, ax1.Legend], ax2) to handle everything at once, then copy over any additional axes properties you need with your existing loop, and if you're still having issues with the legend appearance, recreate it with legend(ax2, L1.String) and manually copy all the legend properties. For more details on legend properties and text color settings, check out the complete documentation at
https://www.mathworks.com/help/matlab/ref/legend.html and
https://www.mathworks.com/help/matlab/ref/matlab.graphics.illustration.legend.text-properties.html .
Hope this helps!