Why is the smoothing effect of【 pcolor() shading interp 】worse on 2025a than the old version 2023b
2 次查看(过去 30 天)
显示 更早的评论
When I updated the latest 2025a, I tried to draw a picture with pcolor() and found that pixel blocks appeared on the picture drawn by the 2025a version, but not in the 2023b version, so I was a little confused why?
The code is as follows,and the data package and operation results are shown in the attachment
clc;clear;close all
load('test.mat')
figure;
figWidth = 14;
figHeight = figWidth * (10 - (-5)) / (160 - 130);
set(gcf, 'Units', 'centimeters', 'Position', [10 10 figWidth figHeight]);
set(gcf, 'Color', 'white', 'InvertHardcopy', 'off');
h = pcolor(a, b, d);
shading interp
set(h, 'EdgeColor', 'none')
caxis([-1.2 1.2])
set(gca, 'YDir', 'reverse','TickDir','out', 'FontSize', 8, 'Box', 'on','FontName','Arial')
colorbar('Location', 'eastoutside','FontName','Arial','FontWeight','normal');
exportgraphics(gca,'test.pdf','BackgroundColor','none','ContentType','vector','Resolution',600)
close all
2 个评论
Paul
2025-7-21
Just to be clear, you're seeing the pixel blocks in 2025a on the screen? Or do you only see that effect in the .pdf after the call to exportgraphics?
Also, the 2025a interpolation doesn't seem to match the 2023b, at least in the area found x = 50 and y = 4.
回答(1 个)
Mathieu NOE
2025-7-21
hello
maybe a temporary work around could be here to resample the data on a finer grid
seems to me the interpolated data pcolor plot (even witout shading int) is equivalent to the raw data plot with shading int (for the earlier release)
clc;clear;close all
load('test.mat')
figure;
figWidth = 14;
figHeight = figWidth * (10 - (-5)) / (160 - 130);
set(gcf, 'Units', 'centimeters', 'Position', [10 10 figWidth figHeight]);
set(gcf, 'Color', 'white', 'InvertHardcopy', 'off');
h = pcolor(a, b, d);
shading interp
set(h, 'EdgeColor', 'none')
caxis([-1.2 1.2])
set(gca, 'YDir', 'reverse','TickDir','out', 'FontSize', 8, 'Box', 'on','FontName','Arial')
colorbar('Location', 'eastoutside','FontName','Arial','FontWeight','normal');
% interpolated plot
k= 3;
da = mean(diff(a))/2^k;
db = mean(diff(b))/2^k;
new_a = a(1):da:a(end);
new_b = b(1):db:b(end);
new_d = interp2(d,k,'linear');
% Vq = INTERP2(V,K) returns the interpolated values on a refined grid
% formed by repeatedly halving the intervals K times in each dimension.
% This results in 2^K-1 interpolated points between sample values.
figure;
figWidth = 14;
figHeight = figWidth * (10 - (-5)) / (160 - 130);
set(gcf, 'Units', 'centimeters', 'Position', [10 10 figWidth figHeight]);
set(gcf, 'Color', 'white', 'InvertHardcopy', 'off');
h = pcolor(new_a, new_b, new_d);
set(h, 'EdgeColor', 'none')
caxis([-1.2 1.2])
set(gca, 'YDir', 'reverse','TickDir','out', 'FontSize', 8, 'Box', 'on','FontName','Arial')
colorbar('Location', 'eastoutside','FontName','Arial','FontWeight','normal');
2 个评论
Mathieu NOE
2025-7-22
my pleasure !
I wished there would be less releases produced but with more robustness and less bugs.
but malab is still my prefered tool by far so I don't shout too loud...and it has so much expanded in many fields that it must be some herculean work to check the new releases (compared to what was matlab in the early days - I started with matlab 4 in the mid 90's)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!