Closed mdsumner closed 4 years ago
Actually, having zlim
as well would be awesome, so that we can easily control the absolute scale without specifying breaks - I'll have a closer look at how this might fit in colourvalues
I see now that it's a colourvalues-like function, but maybe only the addition of the breaks argument and control to colour_values()?
In the absence of directly supporting a breaks
argument, you can supply the "cuts" directly
colourvalues::colour_values( cut(1:20, breaks = 3) )
[1] "#440154FF" "#440154FF" "#440154FF" "#440154FF" "#440154FF" "#440154FF" "#440154FF" "#21908CFF" "#21908CFF"
[10] "#21908CFF" "#21908CFF" "#21908CFF" "#21908CFF" "#FDE725FF" "#FDE725FF" "#FDE725FF" "#FDE725FF" "#FDE725FF"
[19] "#FDE725FF" "#FDE725FF"
colourvalues::colour_values_rgb( cut(1:20, breaks = 3) )
[,1] [,2] [,3] [,4]
[1,] 68 1 84 255
[2,] 68 1 84 255
[3,] 68 1 84 255
[4,] 68 1 84 255
[5,] 68 1 84 255
[6,] 68 1 84 255
[7,] 68 1 84 255
[8,] 33 144 140 255
[9,] 33 144 140 255
[10,] 33 144 140 255
[11,] 33 144 140 255
[12,] 33 144 140 255
[13,] 33 144 140 255
[14,] 253 231 37 255
[15,] 253 231 37 255
[16,] 253 231 37 255
[17,] 253 231 37 255
[18,] 253 231 37 255
[19,] 253 231 37 255
[20,] 253 231 37 255
Is this along the lines of what you're after?
Gee didn't think of that, colour the factor index - need to explore 👍
@mdsumner I haven't looked at this issue since my last comment; is this still relevant for you?
oh no, I built it into palr which is a better fit I think, can just close
I started this as a raster function, to convert a data layer to RGB, with options:
The behaviour is "do what image() can do but without rendering a bit map, give me the data in 3 channel RGB Byte".
I see now that it's a colourvalues-like function, but maybe only the addition of the breaks argument and control to
colour_values()
?The function
cv_rgb()
does what I want to raw values - returning a hex vector. I include the raster and stars forms because they seem to work ...raster_rgb()
, andstars_rgb()
wrap cv_rgb() to give RGB forms (pretty rough and ready for stars).Brought from https://github.com/AustralianAntarcticDivision/palr/issues/2 for wider discussion