Skip to content

[MNT]: Collect style properties in a dedicated object #30828

@timhoffm

Description

@timhoffm

Summary

Current situation

Currently, style information is directly attached to the Artist classes, i.e. mixed with data, metadata (e.g. gid, label) and drawing information (e.g. animated, zorder).

Proposal

I prose to collect the style information in a dedicated container, e.g. a dataclass, that will be a member of the Artist.

Feedback welcome!

Motivation

Similar how the data prototype collects and abstracts data handling, an ArtistStyle collects all visual aspects of the Artist. This creates internal semantic structures: While Artists currently contain a long ist of artist properties with various purposes, we may simplify them by grouping properties by concerns. I anticipate that this will make it easier to reason about them. Also this can enable new features like multiple artists sharing styles, or dynamic style updates.

Additional information

For a start, this would be an internal change, without any modification to the public Artist API.

As an example, I could see the following Line2D properties grouped into a style:

  • alpha
  • antialiased
  • color or c
  • dash_capstyle
  • dash_joinstyle
  • dashes
  • drawstyle
  • fillstyle
  • gapcolor
  • linestyle
  • linewidth
  • marker
  • markeredgecolor
  • markeredgewidth
  • markerfacecolor
  • markerfacecoloralt
  • markersize
  • markevery
  • path_effects
  • rasterized
  • sketch_params
  • snap
  • solid_capstyle
  • solid_joinstyle

This would reduce the non-stype properties to:

  • animated
  • clip_box
  • clip_on
  • clip_path
  • data
  • figure
  • gid
  • in_layout
  • label
  • mouseover
  • picker
  • pickradius
  • transform
  • url
  • visible
  • xdata
  • ydata
  • zorder

Proposed fix

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions