Why do I get different color images using the same MATLAB code?

The MATLAB code I wrote is:

FigHandle = figure; set(FigHandle, 'Position', [0, 0, 1060, 140]); load('velocity0.dat') v=reshape(velocity0,106,14) vt=transpose(v) pim=imagesc(vt) ; set(gca,'XTickLabel',{'1','2','3','4','5','6','7','8','9','10'}, 'FontSize',11) set(gca,'YTickLabel',{'0.15','0.35','0.55','0.75','0.95','1.15','1.35'}, 'FontSize',11) xlabel('distance(km)') ylabel('depth(km)') C = colorbar('location','EastOutside'); caxis([2928,5553]) set(get(C,'XLabel'),'String','velocity(m/s)', 'FontSize',11) 

I am trying to finish my article for a scientific journal. Reviewers asked for new images. However, I have not worked with the code for more than a year, and I do not have MATLAB installed on my new job. So I asked my friend and got this picture below.

enter image description here

Previously, the image in the past looked like this:

enter image description here

Should I change the code to get the desired colors? Is this a color issue?

+5
source share
1 answer

Your friend uses R2014b or later, where the default color map is a color color map . Previously, you used the default color map before R2014b, which is a color map of the jet . As mentioned in the documentation regarding the default color map :

colormap default uses the standard color palette, which is a parula colormap with 64 colors. Versions of MATLAB® prior to R2014b use jet by default.

Therefore, if you want to display the results on this color map in versions of MATLAB that are R2014b or later, simply by calling:

 colormap jet; 

... at the very end of your code will solve your problem. However, do not work with colors. What bothers you is whether your data should follow the distribution of the color bar on the right. Colors are mainly intended for visual display only.

+7
source

All Articles