Skip to content

Proposal: Unify the parameters for semantic legend functions like catlegend and sizelegend... #726

@gepcel

Description

@gepcel

I've been using sizelegend and catlegend recently and ran into a few issues. I initially intended to fix them myself and submit a PR, but as I continued testing, I became increasingly confused. So, I'm writing this as a suggestion for your reference instead.

The parameters for sizelegend and catlegend are currently inconsistent, mixing singular and plural forms. For example, catlegend accepts both colors and color: the former takes a list (mapping to every entry), while the latter accepts a single color applied to all entries. However, it only accepts facecolor (whose value can be a list for every entry) but does not accept the plural form facecolors. And sizelegend only accept color but not colors. I tested a portion of this and did some source code digging, but I quickly got lost in the value parser and argument check functions.

If my explanation isn't clear enough, I suggest you test the following parameters separately for catlegend and sizelegend:
color, colors, facecolor, facecolors, markerfacecolor, markerfacecolors, edgecolor, markeredgecolor, markeredgewidth, etc.

Suggestions:

  1. There is already function like _style_lookup that matches a list (or dict) of values to every entry. I suggest using strictly singular parameters and dropping the plural forms like colors, sizes.
  2. Semantic legend functions support all marker arguments, such as size, markersize, color, facecolor, edgecolor, markerfacecolor, markeredgecolor, markeredgewidth, alpha, etc.
  3. Support all argument aliases, such as: ms, c, mfc, mec, fc, ec, mew, etc
  4. Ensure all arguments about marker styles support both (now some args like labels and colors does, and some like edgecolor doesn't):
    • a single value applied to all entries,
    • a list (or dict) of values applied to each individual entry.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions