Legend size is determined by the number of ticks. For discrete scales, number of ticks = number of breaks. This makes sense, but limits the number of breaks you can have for a discrete scale (assuming you want a legend).
Ticks need to align at the appropriate break between colours and ticks should be evenly spaced, so an arbitrary n_ticks isn't going to work. What we can do though, for a given n_ticks is find the closest number of ticks, such that the ticks are evenly spaced and align with legend breaks.
E.g. A threshold scale that has 9 breaks (including the limits) could have 9, 5, 3, 2 ticks. If asking for 6 ticks, the legend should render 5 (maybe with a warning), the colours on the legend should be half their usual height.
This would allow for arbitrarily complex discrete scales, where the legend is still useful.
Legend size is determined by the number of ticks. For discrete scales, number of ticks = number of breaks. This makes sense, but limits the number of breaks you can have for a discrete scale (assuming you want a legend).
Ticks need to align at the appropriate break between colours and ticks should be evenly spaced, so an arbitrary
n_ticks
isn't going to work. What we can do though, for a givenn_ticks
is find the closest number of ticks, such that the ticks are evenly spaced and align with legend breaks.E.g. A threshold scale that has 9 breaks (including the limits) could have 9, 5, 3, 2 ticks. If asking for 6 ticks, the legend should render 5 (maybe with a warning), the colours on the legend should be half their usual height.
This would allow for arbitrarily complex discrete scales, where the legend is still useful.