Why is the smoothing effect of【 pcolor() shading interp 】worse on 2025a than the old version 2023b

조회 수: 6 (최근 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
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.
da
da 2025년 7월 21일
I only see this effect in the .pdf after calling exportgraphics, there are no blocks of pixels in 【Figure】. By the way, it is true that the results of both versions of 【pcolor() shading interp 】are not exactly the same. Thank you for your answer!

댓글을 달려면 로그인하십시오.

답변 (1개)

Mathieu NOE
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
da
da 2025년 7월 21일
Your method is very effective! Thank you so much! !
So I'm wondering if it's a bug in the new version of MATLAB😂
Mathieu NOE
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)

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Numerical Integration and Differentiation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by