between pcolor & imascn which of them better for correlation plot

조회 수: 5 (최근 30일)
Mahboubeh Molavi-Arabshahi
Mahboubeh Molavi-Arabshahi 2022년 6월 8일
답변: Soumya 2025년 5월 30일
I have a big problem
i used to differennt function pcolor & imascn for showing corrrelation map but i see different plots what's problem because the data are same
i put my code
subplot(1,2,1)
imagescn(lons1,lats1,rs1)
cb1 = colorbar;
ylabel(cb1,'zero-phase correlation')
caxis([-1 1])
cmocean('balance','pivot',0)
subplot(1,2,2)
pcolor(lons1,lats1,rs1');
shading interp;
hold on;
lakes = readgeotable("worldlakes.shp");
geoshow(lakes,"FaceColor","blue")
rivers = readgeotable("worldrivers.shp");
geoshow(rivers,"Color","blue")
cb1 = colorbar;
ylabel(cb1,'zero-phase correlation')
caxis([-1 1])

답변 (1개)

Soumya
Soumya 2025년 5월 30일
The different plots from using ‘pcolor and imagescn’ is because these functions handle matrix data and axis alignment differently. According to the MATLAB documentation, pcolor omits the last row and column of the matrix because it uses vertex-based color interpolation. This causes part of your data to be left out or misaligned. In contrast, imagescn plots the full matrix with values centered in each cell, maintaining correct orientation and full data coverage matrix value as a full cell.
Therefore, 'imagescn' is the preferred choice for plotting correlation maps, especially when working with geospatial data like latitude and longitude grids. It preserves the full structure and scale of the matrix without omitting rows/columns, aligns correctly with the coordinates, and visually represents the data as intended.
The following documentations will give more information on the given functions and their applications:
I hope this helps!

카테고리

Help CenterFile Exchange에서 Discrete Data Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by