[Thread Prev][Thread Next][Index]

Re: Custom line colors



Hi Lynn,
	I found a way to go a little further without overwriting colors
but there is still a limit of 6 different colors in my way.  Following
that however is an alternate way using polygon that removes the limitation
on the number of colors but at the cost of a "boxier" rendition.

*******************************
Another way to define the lines
*******************************
	I think the problem may be something to do with the way ferret
deals with lines.  I modified your script to use /line= rather than
/color= as follows

! test_colors2.jnl
plot/i=1:100/over/line=$2/set/nolabel sin(3.14*i/100)-$1/100
ppl color,$2,$3,$4,$5 ; ppl plot/over

and used it as follows

plot/i=1:100/color=1/line/nolabel sin(3.14*i/100)
repeat/j=1:5   go test_colors2 `j` 1 100 0 0
repeat/j=6:10  go test_colors2 `j` 2 100 50 0
repeat/j=11:15 go test_colors2 `j` 3 100 100 0
repeat/j=16:20 go test_colors2 `j` 4 0 40 0
repeat/j=21:25 go test_colors2 `j` 5 0 0 100
repeat/j=26:30 go test_colors2 `j` 6 80 0 100
repeat/j=31:35 go test_colors2 `j` 7 80 60 100

The first 6 sets of colors showed up fine, but the 7th (/line=7)
used the same color (red) as line=1 is set to but with the doubled
thickness.  So test_colors2 seems to limit one to having still
only 6 separate colors, though different from the default 6.

*******************************
Alternate method using polygons
*******************************
Another idea, if someone else doesn't have a better understanding
of how to have more than 6 colors, would be to use polygon with
a set of customized palettes to render the lines. Maybe one would
need to linearly interpolate the lines to a finer grid to avoid having the
thing look as "boxy" as the demo below.

! making the palettes
The single color palettes like /opt/local/ferret/ferret/ppl/black.spk
are structured like this
0 0 0 0
100 0 0 0
where the first column is the color bar percent limits, and columns
2,3,4 are the R,G,B values as percentages.
So make customized palettes for your color choices
echo '  0 100   0   0' >  my-color1.spk
echo '100 100   0   0' >> my-color1.spk
echo '  0 100  50   0' >  my-color2.spk
echo '100 100  50   0' >> my-color2.spk
echo '  0 100 100   0' >  my-color3.spk
echo '100 100 100   0' >> my-color3.spk
echo '  0   0  40   0' >  my-color4.spk
echo '100   0  40   0' >> my-color4.spk
echo '  0   0   0 100' >  my-color5.spk
echo '100   0   0 100' >> my-color5.spk
echo '  0  40  60  60' >  my-color6.spk
echo '100  40  60  60' >> my-color6.spk
echo '  0  80   0 100' >  my-color7.spk
echo '100  80   0 100' >> my-color7.spk
echo '  0  80  60 100' >  my-color8.spk
echo '100  80  60 100' >> my-color8.spk
...
and render the "lines" using the following commands in a ferret session

! rendering lines as a series of polygons
let bx=ysequence({-0.5,0.5,0.5,-0.5})         !+/- dx/2 for polygon
let by=ysequence({-0.005,-0.005,0.005,0.005}) !+/- dy/2 for polygon
! draw black line
plot/i=1:100/color=1/line/nolabel sin(3.14*i/100)
repeat/k=1:5   (poly/over/nolab/i=1:100/pal=my-color1/coord_ax=y \
                     bx+i,by+sin(3.14*i/100)-`k`/100)
repeat/k=6:10  (poly/over/nolab/i=1:100/pal=my-color2/coord_ax=y \
                     bx+i,by+sin(3.14*i/100)-`k`/100)
repeat/k=11:15 (poly/over/nolab/i=1:100/pal=my-color3/coord_ax=y \
                     bx+i,by+sin(3.14*i/100)-`k`/100)
repeat/k=16:20 (poly/over/nolab/i=1:100/pal=my-color4/coord_ax=y \
                     bx+i,by+sin(3.14*i/100)-`k`/100)
repeat/k=21:25 (poly/over/nolab/i=1:100/pal=my-color5/coord_ax=y \
                     bx+i,by+sin(3.14*i/100)-`k`/100)
repeat/k=26:30 (poly/over/nolab/i=1:100/pal=my-color6/coord_ax=y \
                     bx+i,by+sin(3.14*i/100)-`k`/100)
repeat/k=31:35 (poly/over/nolab/i=1:100/pal=my-color7/coord_ax=y \
                     bx+i,by+sin(3.14*i/100)-`k`/100)
repeat/k=36:40 (poly/over/nolab/i=1:100/pal=my-color8/coord_ax=y \
                     bx+i,by+sin(3.14*i/100)-`k`/100)

Hope this is of help,
Mick

|!!! Mick.Spillane@noaa.gov !!!|
|__Room 2070 Bldg#3 NOAA/PMEL__|
|____Phone_:_(206)526-6780_____|





[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement