clear
clf
disp('Procedure line_patch2 draws set of lines inside the polygon')
disp('defined by coordinates x,y')
disp('USAGE: line_patch2(x,y,n,tang,color,line_style)')
disp('n: integer defining how often lines are drawn, n=50 is OK')
disp('tang: tangent of line inclination, 0-horizontal, NaN -vertical, 1-45deg right, etc')
disp('color: line color [RGB] or color symbol')
disp('line_style: ''-'' solid, ''--'' dashed, etc')
disp('---------------')
disp(' Example shows gray colored dashed lines drawn inside a romb')

x=[-1 0 1 0 -1];
y=[0 -1.5 0 1.5 0];
plot(x,y);
set(gca,'xlim',[-2 2],'ylim',[-2 2])
hold on
n=50
tang=1
color=0.5*ones(1,3)
line_style='--'

disp('Press any key')
pause
line_patch2(x,y,n,tang,color,line_style);
disp('Now you can add left inclined lines by changing tang=-1')
tang=-1
disp('Press any key')
pause
line_patch2(x,y,n,tang,color,line_style);
disp('---------------')
disp('Next example demonstrates how does <colorbar5> draw different lines between')
disp('particular levels of a contour plot, i.e. ''line shading''')
disp('USAGE:  [contour_levels]=colorbar5(hh,line_type,color,line_style,draw_colorbar)')
disp('contour_levels: contours level of a contour plot')
disp('hh:      handle to patch objects returned by contourf program')
disp('line_type: cell array of line types, i.e. {''h'' ''v'' ''R'' ''l'' ''n''}')
disp('''h'' stands for horizontal, ''v'' -vertical, ''n''- no lines')
disp('any combinations are allowed, i.e. ''hv'' hor. and vertical lines')
disp('Press any key')
pause
clf
[cc,hh]=contourf(peaks(100)); clabel(cc,hh);
contour_levels=colorbar5(hh);
contour_levels
disp('length(line_type) must be equal to length(contour_levels)')
line_type={'h' 'v' 'R' 'n' 'n' 'l' 'hv' 'lR' 'hvl'}
draw_colorbar=1
disp('Press any key')
pause
colorbar5(hh,line_type,[0.5 0.5 0.5],'-',draw_colorbar);
label_style
