How to annotate the boundary between fill colours on the legend of a ggplot?

How would you annotate the boundaries between adjacent fill colours on the legend of a ggplot? For example, the annotations "NPS" and "SDS" on this plot legend:

Here is another say to put it -- this time with a reprex (https://git.io/J3gn4).

Consider this other plot:

How would you add an annotation on the legend, between "setosa" and "versicolor", and also between "versicolor" and "virginica". Pretend that the boundary between the red and green fill has some meaning (say "species with small-to-medium sepal length"), as well as the boundary between the green and blue fill (say, "species with medium-to-large sepal length"). And I would like to add reflect that meaning with an annotation right on the legend.

It's quite straight forward to add such annotations on the plot itself, but it seems a lot harder to add them on the legend. Any idea?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.