Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
## colorbar.gle ! Requires 4.0.13 size 12 8 set font ss include "barstyles.gle" set lwidth 0.01 sub local_palette z r g b ! r, g, b is the color of the gradient which will fade towards ! white/grey where (y,y,y) is the shade of white/grey. ! i.e. y = 1 will fade to white local y = 0.95 return cvtrgb(y*(z*(r/255-1)+1),y*(z*(g/255-1)+1),y*(z*(b/255-1)+1)) end sub sub purple_palette z return local_palette(z, 94, 19, 175) end sub sub yellow_palette z return local_palette(z, 255, 255, 0) end sub bar_colormap_pixels = 200 !What does this do? sub bar_purplecolormap x1 y1 x2 y2 b g amove x1 y1 begin clip begin path clip box x2-x1 y2-y1 end path colormap y 0 1 0 1 1 bar_colormap_pixels x2-x1 y2-y1 palette purple_palette end clip end sub sub bar_yellowcolormap x1 y1 x2 y2 b g amove x1 y1 begin clip begin path clip box x2-x1 y2-y1 end path colormap y 0 1 0 1 1 bar_colormap_pixels x2-x1 y2-y1 palette yellow_palette end clip end sub begin graph data "colorbar.dat" xaxis min 0.5 max 4.5 dticks 1 yaxis min -5 max 85 dticks 10 xdsubticks off x2axis off y2axis off yaxis grid yticks color grey20 bar d1,d2 width 0.3,0.3 style purplecolormap,yellowcolormap end graph ! set color white ! Makes black boxes around key color codes disappear, but also makes the key text white. begin key position bc offset 0 -0.5 nobox base 0.25 hei 0.25 coldist 0.5 text "Series 1" fill rgb255(97,19,175) separator text "Series 2" fill rgb255(255,255,0) end key ## colorbar.dat 1 -2 7 2 10 9 3 50 45 4 70 80
This paste will be private.
From the Design Piracy series on my blog: