Illuminate a polygon from psxy

Hi GMT community!

I’ve got some issues with the illumination option of psxy. I’ve got some polygons to plot and I would illuminate them to simulate shadow from the DEM.

Here’s a part of the code:

#Create a simple illumination from the DEM
gmt grdgradient $mnt -Gilu.grd -R9.5/10.54/39.7/40.6 -A33 -Nt1 

#Use topography as background for non covert zone by polygons
gmt grdimage $mnt -R9.5/10.54/39.7/40.6 -JM17 -Ccolor.cpt -Iilu.grd -K > $plot

#Add polygon
gmt psxy $geol_basalte -R -JM -Gp26+fblack+borange+r300 -W0.5 -Iilu.grd -O -K >> $plot

With psxy, I tried -I-1 or -I1 and I can see my color change from darker to whiter but equally in all the polygons. I would like to have variations with shading like with a grdimage.

Is it possible to do that with a psxy and the -I option or is it a lost cost ?

Sorry for my english ^^

The polygon is “flat”, so the illumination made from grdgradient is, well, flat too.
You can achieve the desired effect by having a grid to overlay on your polygon and apply the gradient over it.

As for the specific on how to achieve that … that depends.

I probably would repeat the DEM clipped within the polygon, use the gradient, then re-add the polygon with some transparency.

Does it make sense ?

Thank you for your answer!

I’ll try this and come back if I’m still stuck :wink: