|
From: Manfred S. <man...@gm...> - 2010-09-26 10:02:14
|
Hi Ethan,
>
> After playing around with non-linear discrete palettes like the one in your
> problem figures, I have become suspicious that the problem is more serious
> than just the resolution of the color box. The palette colors assigned to
> individual points are also wrong. That is, the bad coloring in the color box
> is a correct representation of the coloring assigned to elements of the plot.
>
Yes, I found that changing this colorbar code, it changes also the the
plot itself, perhaps because of the "set_color(gray);" line inside of the loop?
> Now it may be that the way I constructed a test palette is not a good way
> to do it. I'll show my test below.
>
> set palette defined (0 "purple", 1 "blue", \
> 1 "blue", 2 "dark-green", \
> 2 "dark-green", 4 "spring-green", \
> 4 "spring-green", 8 "yellow", \
> 8 "yellow", 16 "orange", \
> 16 "orange", 32 "red" \
> )
> set xrange [0:32]
> set cbrange [0:32]
> set ytics 2
> set cbtics 2
> set grid y
>
> plot '+' using 1:1:1 with points lt 7 lc palette
>
> pause -1
>
> # Limiting the number of colors makes it much worse, and clarifies that the
> # error comes from assigning colors to the palette in equal increments
> # rather that looking at the requested range boundaries:
> set palette maxcolors 7
> replot
>
>
> So apparently one cannot create a discrete palette this way.
> Or at least you cannot create a discrete palette with unequal color ranges.
> Using "show palette palette 7" confirms this, I think.
>
> But maybe there's another way that works better.
> Perhaps you could create a palette by hand and load it using
> set palette file 'mypalette.dat'
> Unfortunately the documentation is not very helpful as to exactly how color
> ranges are assigned to colors that are read in from a file.
>
> What commands produced the palette in your problem case?
I did something along this (I want to change colors exactly at
values 1,2.5,5,10,....200):
set term png truecolor small size 770,610
set out "|cat"
set pm3d map
s=-1.0
d=200-(-1.0)
set palette defined ( 0.0 "#DDDDDD", (-0.01-s)/d "#DDDDDD", \
(-0.01-s)/d "white", (1.0-s)/d "white", \
(1.0-s)/d "#FFFF00", (2.5-s)/d "#FFFF00", \
(2.5-s)/d "#C1FFB4", (5.0-s)/d "#C1FFB4", \
(5.0-s)/d "#92E178", (10.0-s)/d "#92E178", \
(10.0-s)/d "#6EC36E", (20.0-s)/d "#6EC36E", \
(20.0-s)/d "#49913C", (30.0-s)/d "#49913C", \
(30.0-s)/d "#577350", (40.0-s)/d "#577350", \
(40.0-s)/d "#5050C8", (50.0-s)/d "#5050C8", \
(50.0-s)/d "#6600AA", (100.0-s)/d "#6600AA", \
(100.0-s)/d "#993399", (150.0-s)/d "#993399", \
(150.0-s)/d "#AA3366", (199.99-s)/d "#AA3366", (200.0-s)/d "#FF66FF" )
set cbrange [-1.0:200]
splot [:][:][:] '/tmp/mydata' matrix notitle
set output
>
> Ethan
>
>
>> As Dan suggested, if there are only 5 colors in the palette then we need
>> only draw 5 rectangles in the color box. Unlike the current code,
>> however, they shouldn't be evenly spaced. The endpoints of each rectangle
>> should be taken from the palette definition so that they will indeed be
>> placed with perfact accuracy.
>>
>> Ethan
>>
>>>
|