plotly / plotly/plotly.py

Streamline xanchor and yanchor names for center/middle

Open
#5,326 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature P3
Dominant language
Python
Stars
18.8k
Forks
2.8k
Avg merge
16h 26m
Merged PRs (30d)
21

Description

The 'xanchor' property is an enumeration that may be specified as:
- One of the following enumeration values:
['auto', 'left', 'center', 'right']

The 'yanchor' property is an enumeration that may be specified as:
- One of the following enumeration values:
['auto', 'top', 'middle', 'bottom']

This is for plotly 6.3.0 trying to use fig.add_annotations() but it likely applies everywhere where xanchor and yanchor are used.

It does make sense that for the extremes of the bounding box left right top bottom, the names are different, but why is 'center' used for x direction and 'middle' for y direction? This distinction seems artifical to me and I wonder why this was chosen?

I propose to streamline the naming conventions, but now for backwards compatibility to at least accept both center/middle for x/yanchor.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the fig.add_annotations() entry point and locate how xanchor and yanchor values are validated. Check whether the same validation is shared elsewhere, then review any related tests. Done should include backward-compatible acceptance of both center and middle where appropriate, with existing values still working.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-visualization
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.