0001 function addAreaShadows( axh )
0002
0003
0004
0005
0006
0007
0008
0009
0010 shadowColor = 0.6*[1 1 1];
0011
0012
0013 shadowSize = 1/300;
0014
0015
0016 l = findall( axh, 'Tag', 'FunkyAxes:AreaShadow' );
0017 if ~isempty( l )
0018 delete( l )
0019 end
0020
0021
0022 dx = diff( get( axh, 'XLim' ) )*shadowSize;
0023 dy = -diff( get( axh, 'YLim' ) )*shadowSize;
0024 if strcmpi( get( axh, 'XDir' ), 'Reverse' )
0025 dx = -dx;
0026 end
0027 if strcmpi( get( axh, 'YDir' ), 'Reverse' )
0028 dy = -dy;
0029 end
0030 z0 = get( axh, 'ZLim' );
0031 z0 = z0(1) - max(0.1,diff( z0 )*shadowSize);
0032
0033
0034 patches = findobj( axh, 'type', 'patch' );
0035 patches( strcmpi( get( patches, 'Tag' ), 'FunkyAxes:AxesBackground' ) ) = [];
0036 props_to_copy = {
0037 'XData'
0038 'YData'
0039 'ZData'
0040 'FaceColor'
0041 'EdgeColor'
0042 'LineStyle'
0043 'LineWidth'
0044 };
0045
0046
0047
0048 vals = cell( size( props_to_copy ) );
0049 l = -1*ones( size( patches ) );
0050 for jj=1:numel( patches )
0051 l(jj) = patch( nan, nan, nan, ...
0052 'Tag', 'FunkyAxes:AreaShadow', ...
0053 'Parent', axh );
0054 for kk=1:numel( props_to_copy )
0055 vals{kk} = get( patches(jj), props_to_copy{kk} );
0056 end
0057 args = [props_to_copy,vals]';
0058 set( l(jj), args{:} );
0059
0060 set( l(jj), ...
0061 'FaceColor', shadowColor, ...
0062 'EdgeColor', shadowColor, ...
0063 'XData', get( patches(jj), 'XData' ) + dx, ...
0064 'YData', get( patches(jj), 'YData' ) + dy, ...
0065 'ZData', z0*ones( size( get( patches(jj), 'XData' ) ) ), ...
0066 'HitTest', 'off' );
0067 end