Hey,
I would like to narrow down a colour palette to use only a certain color range.
For example for viridis, which goes from dark blue to turquoise to yellow. I would like to have my data only in turquoise to yellow.
Of course there's the obvious way of just redefining the palette.
Also possible: if my data ranges from 0-10, I could set the cb range from -10:10 and have the wanted effect, but then my colorbox would be from -10:10 as well (which would be sufficient to cover 0:10).
So, my question could also be asked as: is there a way to control the range shown in the colorbox and the range of the palette individually, or they both are exclusively controlled via the cb range?
Thanks,
Alex
set cbrange
maps the entire palette onto some range of values. There is no single command that will map only a portion of the palette. You can, however, expand a portion of the existing palette to replace the whole thing, which would satisfy your starting example of using only the top half of the viridis palette:Does that help?
Dear Ethan,
thanks a lot, that's what I was looking for!
Last edit: Alexander Stangl 2025-06-24