has2k1 / plotnine

A Grammar of Graphics for Python
https://plotnine.org
MIT License
4.02k stars 217 forks source link

Support `key_glyph` #866

Open bhvieira opened 2 months ago

bhvieira commented 2 months ago

In ggplot2, geom_* callables support a key_glyph argument:

Each geom has an associated function that draws the key when the geom needs to be displayed in a legend. These functions are called draw_key_*(), where * stands for the name of the respective key glyph. The key glyphs can be customized for individual geoms by providing a geom with the key_glyph argument ( from https://github.com/tidyverse/ggplot2/blob/main/R/legend-draw.R)

In the future, it would be really useful if plotnine supported it as well.

See https://ggplot2.tidyverse.org/reference/draw_key.html

has2k1 commented 1 month ago

Internally this is kind of there with the geom.draw_legend static methods, but it is not quite meant for the user.