![]() |
The symmetric models HuSLp (CIELUV and CIELAB) and HSYp (YPbPr) |
![]() |
Surfaces of maximum S: HSL (top); HuSLab, HSY (middle); HuSLpab, HSYp (bottom) |
In this example, we create three colormaps corresponding to the hue angles of the primary and secondary colors. Note the brightness variation in HSL; anyone who has spent any time making plots in Matlab has probably found themselves avoiding certain named line colors due to their poor visibility ('b' on black, 'y' on white). While notably less saturated, the HSYp and HuSLp colormaps yield lines which are all equally visible. Here, the HuSLp method uses CIELUV simply because the saturated corners of the RGB space are not 60 degrees apart in CIELAB. Also, take note that I'm inverting colors in the plot() call and in the imwrite() call because I'm operating with an inverted X display.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | steps=6; H=0:360/steps:(360-360/steps); K= ones ( size (H)); hslset= permute (colorspace( '<hsl' , cat (3,H,K,K*0.5)),[2 3 1]); hsypset= permute (hsy2rgb( cat (3,H,K,K*0.6), 'pastel' ),[2 3 1]); huslpset= permute (husl2rgb( cat (3,H,K*100,K*65), 'luvp' , 'aligned' ),[2 3 1]); lw=2; x=0:0.01:1.4; os=2; d=9; sl=1.2; subplot_tight(1,1,1); for n=1:1:steps; plot (x, ( atan (x/(n/d))-sl*x), 'color' ,1-hslset(n,:), 'linewidth' ,lw); hold on; plot (x, -( atan (x/(n/d))-sl*x), 'color' ,1-hslset(n,:), 'linewidth' ,lw); hold on; plot (x,1*os+( atan (x/(n/d))-sl*x), 'color' ,1-hsypset(n,:), 'linewidth' ,lw); hold on; plot (x,1*os-( atan (x/(n/d))-sl*x), 'color' ,1-hsypset(n,:), 'linewidth' ,lw); hold on; plot (x,2*os+( atan (x/(n/d))-sl*x), 'color' ,1-huslpset(n,:), 'linewidth' ,lw); hold on; plot (x,2*os-( atan (x/(n/d))-sl*x), 'color' ,1-huslpset(n,:), 'linewidth' ,lw); hold on; end view (-90, 90); set ( gca , 'ydir' , 'reverse' ); to=-0.45; text (1,-to , 'HSL' , 'fontsize' ,16, 'fontweight' , 'bold' ); text (1,-to+1*os, 'HSYp' , 'fontsize' ,16, 'fontweight' , 'bold' ); text (1,-to+2*os, 'HuSLpuv' , 'fontsize' ,16, 'fontweight' , 'bold' ); frame= getframe ; imwrite (255-frame.cdata, 'blogshit/colormaps1.png' , 'png' ); |
![]() |
Plots using colormaps generated in HSL, HSYp, HuSLp |
Maybe I'll do more to extend these tools toward making discontinuous color sets at higher chroma, but I think there are plenty of people working on that already. Then again, it's not like I'm unaccustomed to reinventing wheels. It's not like I have anything better to do, either.
No comments:
Post a Comment