results in a red (150/1/1) rather than green (150-1-1) color. I cannot imagine any scenario where we want this to happen. There is also COLOR_MODEL which I think is only used with CPTs and does not affect the above command. Looking just at the documentation, I am not sure what these settings do for us. Here they are:
COLOR_MODEL
Selects in which color space a CPT should be interpolated. By default, color interpolation takes place directly on the RGB values which can produce some unexpected hues, whereas interpolation directly on the HSV values better preserves those hues. The choices are: none (default: use whatever the COLOR_MODEL setting in the CPT demands), rgb (force interpolation in RGB), hsv (force interpolation in HSV), cmyk (assumes colors are in CMYK but interpolates in RGB).
PS_COLOR_MODEL
Determines whether PostScript output should use RGB, HSV, CMYK, or GRAY when specifying color [rgb]. Note if HSV is selected it does not apply to images which in that case uses RGB. When selecting GRAY, all colors will be converted to gray scale using YIQ (television) conversion.
All (?) our CPTs are written with color-codes as strings (names, r/g/b, or h-s-v) so it is not possible to misunderstand what color is desired. I think COLOR_MODEL is used to control interpolation of color and can override what we do, but with a default of RGB we are interpolating within CPT slices using r,g,b values unless the CPT says otherwise. So changing this would change color interpolation in subtle ways. Some CPTs has a COLOR_MODEL=hsv because they are given in hsv and have maybe one slice.
PS_COLOR_MODEL is less clear. It also defaults to RGB and the setting is not used in GMT but passed to PSL_beginplot and from what I can tell it simply converts r/g/b to h/s/v and then requests the color as hsv. For instance, the difference bewteen the PostScript produced above with or without the PS_COLOR_MODEL setting is this:
< {0 1 0.5 C} FS
---
> {150 1 1 H} FS
where C is shorthand for PostScript operator setrgbcolor and H stands for sethsbcolor (hsb == hsv). Ah, but sethsbcolor expects three arguments in the 0-1 range while we are passing hue as a 0-360 angle. So that is the (ancient) bug that caused the current failure - I will open a PR shortly. Regardless, I think these options are not intended to be changed by mere users. Perhaps @remkos has some history to share here as to why we may want the PostSCript file to use HSV instead of RGB when in the end the same colors will be shown (the bug be damned)?
Description of the problem
See the original posting on the forum. Clearly, we have some internal mistakes when command like this
echo 0 0 | gmt plot -R-3/3/-3/3 -Jx2i -Sc1i -G150-1-1 -pdf t --PS_COLOR_MODEL=HSV
results in a red (150/1/1) rather than green (150-1-1) color. I cannot imagine any scenario where we want this to happen. There is also COLOR_MODEL which I think is only used with CPTs and does not affect the above command. Looking just at the documentation, I am not sure what these settings do for us. Here they are:
COLOR_MODEL Selects in which color space a CPT should be interpolated. By default, color interpolation takes place directly on the RGB values which can produce some unexpected hues, whereas interpolation directly on the HSV values better preserves those hues. The choices are: none (default: use whatever the COLOR_MODEL setting in the CPT demands), rgb (force interpolation in RGB), hsv (force interpolation in HSV), cmyk (assumes colors are in CMYK but interpolates in RGB).
PS_COLOR_MODEL Determines whether PostScript output should use RGB, HSV, CMYK, or GRAY when specifying color [rgb]. Note if HSV is selected it does not apply to images which in that case uses RGB. When selecting GRAY, all colors will be converted to gray scale using YIQ (television) conversion.
All (?) our CPTs are written with color-codes as strings (names, r/g/b, or h-s-v) so it is not possible to misunderstand what color is desired. I think COLOR_MODEL is used to control interpolation of color and can override what we do, but with a default of RGB we are interpolating within CPT slices using r,g,b values unless the CPT says otherwise. So changing this would change color interpolation in subtle ways. Some CPTs has a COLOR_MODEL=hsv because they are given in hsv and have maybe one slice.
PS_COLOR_MODEL is less clear. It also defaults to RGB and the setting is not used in GMT but passed to PSL_beginplot and from what I can tell it simply converts r/g/b to h/s/v and then requests the color as hsv. For instance, the difference bewteen the PostScript produced above with or without the PS_COLOR_MODEL setting is this:
where C is shorthand for PostScript operator setrgbcolor and H stands for sethsbcolor (hsb == hsv). Ah, but sethsbcolor expects three arguments in the 0-1 range while we are passing hue as a 0-360 angle. So that is the (ancient) bug that caused the current failure - I will open a PR shortly. Regardless, I think these options are not intended to be changed by mere users. Perhaps @remkos has some history to share here as to why we may want the PostSCript file to use HSV instead of RGB when in the end the same colors will be shown (the bug be damned)?