[WIP] Customizable colorrange handling #3688
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR introduces a function
evaluate_colorrange
, which can be extended by users for their own colorrange types. It currently has dispatches forAutomatic
andFunction
input, with the default dispatch converting the givencolorrange
toVec2{Float64}
.The objective here is to allow users to pass anything they want to determine the colorrange, so long as it returns appropriate output. This is a completion of one of the points of discussion at MakieCon.
It should now be possible to implement structs for colorranges which must be centered about zero, quantile-based colorranges, and any other metric. In addition, functions like
PlotUtils.zscale
can be passed freely, or any user-provided function that returns a 2-tuple or similar.Unfortunately, scaling colormaps about zero such that the center is at zero but the top and bottom halves have different scales is not possible to implement in the framework of this PR - that would have to be a separate colormap object and would involve a lot more handling.
The PR still needs tests and examples, but I want to get an understanding of whether this is the right way to go or not.
Type of change
Delete options that do not apply:
Checklist