Imprecise copying of axes

1 view (last 30 days)
Tobias Fink
Tobias Fink on 7 Sep 2020
Hello everyone,
I created an GUI via Code which shows me different figures depending on the input.
Since you can't save uifigures I then create a normal figure which takes all the data from the uifigure axis and save that.
The problem now is that while it works perfectly fine on the axis with a big range for the caxes, it looses a lot of data when the caxis is in a range from 0 to 1.
As you can see in the pictures below, the top one being the original from the uifigure and the bottom one being the copied version, the left plot looks the same even when zoomed in, while the right one clearly doesn't.
This is the code I'm using to copy the grey (Right) plot with the uifig.Children(i,1) being the uiaxes I want to copy from and ax1 the axes I want to copy into
XLim=xlim(uifig.Children(i,1));
YLim=ylim(uifig.Children(i,1));
dBLim=uifig.Children(i,1).CLim;
surface(ax1, uifig.Children(i,1).Children.XData, uifig.Children(i,1).Children.YData, uifig.Children(i,1).Children.ZData);
shading(ax1, 'interp');
xlabel(ax1, uifig.Children(i,1).XLabel.String);
ylabel(ax1, uifig.Children(i,1).YLabel.String);
set(ax1,'Layer','top');
set(ax1,'YDir','normal');
set(ax1,'Box','on');
set(ax1,'XMinorTick','on');
set(ax1,'YMinorTick','on');
colormap(ax1, gray);
colorbar(ax1, 'eastoutside');
axis(ax1, [XLim(1) XLim(2) YLim(1) YLim(2)]);
caxis(ax1, [dBLim(1) dBLim(2)]);
set(ax1, 'FontName', 'Arial','FontSize',14);
Does anybody know why the grey plot get so imprecise?
The only difference in code to the coloured one is the "colormap" command.
Best regards
Tobias

Answers (0)

Categories

Find more on Develop uifigure-Based Apps in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!