between pcolor & imascn which of them better for correlation plot

4 views (last 30 days)
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])

Answers (1)

Soumya
Soumya on 30 May 2025
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!

Categories

Find more on Discrete Data Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!