|
From: Ethan M. <eam...@gm...> - 2015-04-13 23:33:55
|
On Mon, Apr 13, 2015 at 10:53 AM, Patrick Alken
<pat...@co...> wrote:
>
>> There was a change in handling "maxcolors", but the change came several
>> years ago. It is not connected to version 4 / version 5.
>> I think the new behavior was first introduced in 4.4.3 (Mar 2011) and
>> tweaked a bit in later versions.
>>
>> The change is that terminals with full RGB color support will always
>> give you any explicitly requested color. That is, "maxcolors" will
>> determine how many subdivisions are made for an interpolated palette,
>> e.g.
>> set palette defined (0 "red", 1 "blue") maxcolors 5
>> test palette
>> But if you request, say, 20 explicit color ranges you will get all
>> of them even though you said "maxcolors 5"
>
> I don't understand the purpose of maxcolors then. As a user I want the
> ability to switch between a continuous or discrete palette
That is exactly what "maxcolors" can do.
But you didn't have a continuous palette. You had a 256-color discrete palette.
Maxcolors does not magically select 5 of your 256 colors and throw
away the rest.
Moreland gives the generating equations for the MSH color space used
to generate the palette you started with. You could either use these to
describe a continuous palette using "set palette functions" or you could
contribute a new bit of code to select the MSH colorspace as an alternative
to RGB/CMY/HSV/YIQ/etc. Either way the "maxcolors" option would then
work to sample from a continuous palette.
Here is a quick try at defining a similar (but not exact) continuous palette:
R(x) = 0.2 + 0.8 * sin(x*2.2)
B(x) = 0.2 + 0.8 * sin(0.9 + x*2.2)
G(x) = 0.3 + 0.83 * sin(x * 3.) - 0.4*x
set palette functions R(gray), G(gray), B(gray)
set palette maxcolors 5
test palette
If those continuous functions are not close enough to the Moreland palette,
you can replace them with the equations from the paper.
Ethan
> I shouldn't need to condense my 256 color palette down to 8 colors myself
> in order to achieve this. It seems to me that should be the purpose of
> the maxcolors feature.
> Since I manage to get my desired result in the 'x11' terminal I will
> continue using that. But it sounds like when I try to print to png or
> pdf, I may end up with a different plot.
>
> Could I request that the maxcolors be changed to automatically define
> discrete color levels even if more colors are provided in the palette?
|