shadedpcolor displays one dataset in color, and a second by varying the intensity of the pixels in the image. We use this for displaying the vertical gradients in a field on top of the field itself. It really makes the field more three-d. A similar effect can be achieved by using lighting, but this is much more deterministic.
For the above picture I ran:
shadedpcolor(x,z,U,(dU),[-1 1]/4,[-1 1]/300,0.7,cmp,0);
Jody Klymak (2020). Shaded pseudo color (https://www.mathworks.com/matlabcentral/fileexchange/14157-shaded-pseudo-color), MATLAB Central File Exchange. Retrieved .
Could you help me figure out how to get a handle for the figure.
If I run the code like this:
h=shadedpcolor(x,y,data,(data_slope)),[-3 3],[0 1],0.55,mycmap,0);
this is what happens
??? Output argument "h" (and maybe others) not assigned during call to "G:\For blog\Campi slope\shadedpcolor.m (shadedpcolor)".
Error in ==> shadedpcolor at 31
But hp is not stored in a variable that I can use.
If I simply run the code without output arguments, like this:
shadedpcolor(x,y,data,(data_slope)),[-3 3],[0 1],0.55,mycmap,0);
no error messages, but still cannot get a handle.
The figures resulting from the code snippet above are in the submission Perceptually improved colormaps (example2). Thank you
This is a great way to add shading to your data. I used it with very nice results with gravity anomalies with this code:
% shadedpcolor(x,y,residual,slp,[clim residual],[clim slp],0.55,jet(256),0);
% axis equal; axis off; axis tight;
% shadedcolorbar([clim residual],0.55,jet(256));
Inspired by: freezeColors / unfreezeColors