-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Description
Problem
Currently, boxplots do not get legend entries. #27711 was an attempt to introduce them but only solved one very particular usecase and did not generalize well. See #27780.
There is a labels parameter, but that only sets x-tick labels. And it has one entry per box. For the legend we should have only one entry per boxplot() call no matter how many boxes that has, because boxplot draws N identically styled boxes and it does not make sense to have N identical handles with different labels.
Because of the x-tick relation of labels and it's relation to individual boxes, this parameter is not suited for the legend labels.
Proposed solution
We need a separate parameter. There are basically two options:
Variant 1) legend_label: str
pro: simple and clear, no interference with the existing API
con: inconsistent with the rest of the library: all other functions use label for the legend entry.
Variant 2) label: str
pro: consistent with the rest of the library
con: Having label alongside labels is quite confusing and easily leads to errors. (We could runtime-check for the type str vs list of str, to give helpful error messages but still ...)
If we want to go this way, we should rename labels to tick_labels or similar.