You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's currently easy to get a beautiful red-blue diverging colormap with, e.g. 20 colors by calling
colormap("RdBu", 20)
I would like to be able to map a continuous variable (for definiteness, say it ranges from -1.0 to 1.0) into this map, but I don't currently see an easy way to do this. Basically what I'm asking for is the N → ∞ limit of
function (x)
colormap("RdBu", N)[1 + ifloor((x + 1.0)/2.0*N)]
end
I haven't gotten completely to the bottom of the way things are currently implemented, but given that you can already specify different values for N, it seems like something close to such a function must already exist privately somewhere inside the implementation, and it would be nice to expose it.
The text was updated successfully, but these errors were encountered:
Under the hood colormaps are just Bezier splines in LCHuv colorspace from one color to other so what you are asking is completely possible. Instead of using the colormap function that splices the continuous representation into parts, you can use the underlying functions and call the splines directly with what ever value you want.
It's currently easy to get a beautiful red-blue diverging colormap with, e.g. 20 colors by calling
I would like to be able to map a continuous variable (for definiteness, say it ranges from -1.0 to 1.0) into this map, but I don't currently see an easy way to do this. Basically what I'm asking for is the N → ∞ limit of
I haven't gotten completely to the bottom of the way things are currently implemented, but given that you can already specify different values for
N
, it seems like something close to such a function must already exist privately somewhere inside the implementation, and it would be nice to expose it.The text was updated successfully, but these errors were encountered: