File Exchange

image thumbnail

Shaded pseudo color

version 1.0 (772 KB) by

Use shading to represent secondary information of an image



View License

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);
axis ij;
shadedcolorbar('v',[-1 1]/4,0.7,cmp);

Comments and Ratings (3)

Hi Jody

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
hp =


??? Output argument "h" (and maybe others) not assigned during call to "G:\For blog\Campi slope\shadedpcolor.m (shadedpcolor)".

Error in ==> shadedpcolor at 31
if nargin==0

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);

I get
hp =


no error messages, but still cannot get a handle.


Matteo Niccoli

The figures resulting from the code snippet above are in the submission Perceptually improved colormaps (example2). Thank you

Matteo Niccoli

This is a great way to add shading to your data. I used it with very nice results with gravity anomalies with this code:

% slp=1-normalized_slope;
% 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));

MATLAB Release
MATLAB 7.3 (R2006b)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video