Size revamp 1: Scale.size_discrete2 #1376
Merged
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.
NEWS.md
This PR
Scale.size_discrete2
in the style ofScale.color_discrete
.Scale.size_discrete
can be switched to the new function e.g. in Gadfly 2.0. Until then,Scale.size_discrete2
can be used.Scale.size_discrete2(f=default_discrete_sizes)
,f
is a function which maps from categorical values toMeasure
units, and allows arbitrary mappings.default_discrete_sizes
has the same range as currently provided byTheme(point_size_min, point_size_max)
Theme(discrete_sizemap=default_discrete_sizes)
replacesTheme(point_size_min, point_size_max)
, which can be deprecated.Example
This PR fixes the problem mentioned in #1358 with plot p2. Example:
In
pcurrent
, the y-axis is expanded by ±3 becauseScale.size_discrete
mapssize
to Integers (1:3). The mapping of the size aesthetic to size units needs to happen earlier, as inpnew
, withScale.size_discrete2