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
guide_coloursteps() and guide_bins() seems to give incorrect guide when breaks are not sorted in increasing direction.
In the example below, we can see the coloursteps aren't right. The same happens with continuous scales, but binned scales come with coloursteps by default, so that reprex was more minimal. This doesn't only happen when the breaks are sorted in descending order as in the example below, but this generally seems to happen when they're not increasing.
The guide system, as the last remaining chunk of ggplot2, has been rewritten
in ggproto. The axes and legends now inherit from a <Guide> class, which makes
them extensible in the same manner as geoms, stats, facets and coords
(#3329, @teunbrand). In addition, the following changes were made:
* Styling theme parts of the guide now inherit from the plot's theme
(#2728).
* Styling non-theme parts of the guides accept <element> objects, so that
the following is possible: `guide_colourbar(frame = element_rect(...))`.
* Primary axis titles are now placed at the primary guide, so that
`guides(x = guide_axis(position = "top"))` will display the title at the
top by default (#4650).
* Unknown secondary axis guide positions are now inferred as the opposite
of the primary axis guide when the latter has a known `position` (#4650).
* `guide_colourbar()`, `guide_coloursteps()` and `guide_bins()` gain a
`ticks.length` argument.
* In `guide_bins()`, the title no longer arbitrarily becomes offset from
the guide when it has long labels.
* The `order` argument of guides now strictly needs to be a length-1
integer (#4958).
* More informative error for mismatched
`direction`/`theme(legend.direction = ...)` arguments (#4364, #4930).
* `guide_coloursteps()` and `guide_bins()` sort breaks (#5152).
guide_coloursteps()
andguide_bins()
seems to give incorrect guide when breaks are not sorted in increasing direction.In the example below, we can see the coloursteps aren't right. The same happens with continuous scales, but binned scales come with coloursteps by default, so that reprex was more minimal. This doesn't only happen when the breaks are sorted in descending order as in the example below, but this generally seems to happen when they're not increasing.
You'd expect the guide to look like this:
Created on 2023-01-18 with reprex v2.0.2
I think the fix would be a simple sorting step in the guide training.
The text was updated successfully, but these errors were encountered: