This code produces the following plot with mismatched labels in the legend.
It looks like a similar issue was addressed in the past (#445), but the issue still persists here.
On a side note, why does the legend use a default title when an empty string is passed as the name? This seems like strange behavior to me and isn't clearly documented. (The documentation states: "Name used as the label of the scale. This is what shows up as the axis label or legend title. Suitable defaults are chosen depending on the type of scale.")
The order of the breaks and labels parameters for scale_color_identity are not being matched properly. Here is a reproducible example:
This code produces the following plot with mismatched labels in the legend.
It looks like a similar issue was addressed in the past (#445), but the issue still persists here.
On a side note, why does the legend use a default title when an empty string is passed as the name? This seems like strange behavior to me and isn't clearly documented. (The documentation states: "Name used as the label of the scale. This is what shows up as the axis label or legend title. Suitable defaults are chosen depending on the type of scale.")