-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scale capability: Use native colour format if the geom prefers it #5033
base: main
Are you sure you want to change the base?
Scale capability: Use native colour format if the geom prefers it #5033
Commits on Nov 6, 2022
-
Configuration menu - View commit details
-
Copy full SHA for 549fae9 - Browse repository at this point
Copy the full SHA 549fae9View commit details -
FEAT/PERF: ScaleContinuous accepts palette capability
may_return_na
We can extend palettes with attributes to improve the mapping efficiency. With this commit a palette may define an attribute `may_return_na` to `FALSE`. If it does, `ScaleContinuous` will assume the palette may not return missing values, and it will skip checking for those and replacing them.
Configuration menu - View commit details
-
Copy full SHA for 99b7c60 - Browse repository at this point
Copy the full SHA 99b7c60View commit details -
Configuration menu - View commit details
-
Copy full SHA for d9e577d - Browse repository at this point
Copy the full SHA d9e577dView commit details -
Configuration menu - View commit details
-
Copy full SHA for e86c02a - Browse repository at this point
Copy the full SHA e86c02aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 04d21e3 - Browse repository at this point
Copy the full SHA 04d21e3View commit details -
FEAT/PERF: Implement mapping_method support for ScaleContinuous
ScaleContinous maps values to palette colours as follows: - unique values are found - unique values are mapped to colors - colors are matched to the original vector If most values are unique, we can be faster by simply maping all values to colors, without finding and matching unique values first. In some scenarios the geom can guess or know if that is going to be the case. The goal of this commit is to let the geom tell the ScaleContinuous scale how the mapping from values to colours should be done. By default the existing "unique" approach is used. The geom may now specify `scale_params = list(fill=list(mapping_method = "raw"))` to tell the scale corresponding to the fill aesthetic to use a "raw" approach of mapping values to colours without finding unique values first. Besides the default "unique" and the new "raw" mapping methods, we also allow the geom to ask to use the "binned" approach, where the geom specifies a number of intervals to use and the mapping process is as follows: - values are binned in N intervals - intervals are mapped to colors This approach is "lossy" (we have a maximum of N different colours), but this can be much faster and have almost no difference with respect to the other mapping methods.
Configuration menu - View commit details
-
Copy full SHA for 8e365c0 - Browse repository at this point
Copy the full SHA 8e365c0View commit details -
Configuration menu - View commit details
-
Copy full SHA for afa0d44 - Browse repository at this point
Copy the full SHA afa0d44View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6513a17 - Browse repository at this point
Copy the full SHA 6513a17View commit details -
FEAT: ScaleContinuous can return native colour format
Some geoms benefit from using native colour format instead of the character based colour format. This commit lets the geoms specify that they prefer native format for colours, and gives the responsibility of converting into that format to ScaleContinuous. Since today it is not mandatory for all scales to honor scale_params, the geom that requests this will have to verify that the color is given in native format anyway, and do the conversion if it has not been done here. However by optionally shifting the responsibility of the conversion to the scale we have potential to further optimizations
Configuration menu - View commit details
-
Copy full SHA for 44a4d08 - Browse repository at this point
Copy the full SHA 44a4d08View commit details -
PERF: Palette capability: accepts_native_output=TRUE
If a palette has accepts_native_output=TRUE set as an attribute, ScaleContinuous assumes the palette has an optional argument named `color_fmt` which can be set to either "character" or "native". If the geom prefers a native output format and the palette supports it, we let the palette take care of it. The conversion goes from value -> native colour, which is much faster than going through an intermediate character representation of the colours.
Configuration menu - View commit details
-
Copy full SHA for 8a18be6 - Browse repository at this point
Copy the full SHA 8a18be6View commit details -
Configuration menu - View commit details
-
Copy full SHA for fdfd6d9 - Browse repository at this point
Copy the full SHA fdfd6d9View commit details