MATLAB: How to add a diagonal gradient and corresponding colorbar to a plot

colorbargradientMATLABplot

This is what I'd like to create with my own data, how can I add that gradient and colorbar to my plot

Best Answer

An example:
[X,Y] = meshgrid(1:0.1:3);
Z = X+Y;
pcolor(X,Y,Z)
shading interp
colorbar('Location','NorthOutside')
You can also create your own colormap
Related Question