plotly / plotly/plotly.js

[Feature request] Allow annotations and layout images to be positioned relative to the container, not just the x/y axes or plotting area

Open
#7,665 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature P2
Dominant language
JavaScript
Stars
18.3k
Forks
2k
Avg merge
2d 12h
Merged PRs (30d)
28

Description

One thing I really appreciate about title positioning in Plotly is that I can set title locations relative to the container, not just the plotting area or x axis, via the title_xref and title_yref settings. This makes it much easier to achieve consistent title placement across different charts, as many different factors can change the shape of the plotting area.

Would it be possible to add container as an xref and yref option for annotations and images also? I've been needing to manually adjust these across charts, which can take a decent amount of time. (For PNG exports, I can achieve consistent placements by adding them in via Pillow, but this won't help for HTML-based charts.)

Also, one somewhat-related question (which I'm happy to move to a separate issue if needed): Is there a way to ensure that an image will always be the same size, in pixels, as long as the width of the chart (in pixels) is always the same? It appears that, even when the sizex and sizey settings stay the same, the image size can vary. (Since these values are relative to the chart's area, though, this is probably to be expected. But being able to specify a fixed size, e.g. 300x200px, would be fantastic.)

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

The request concerns annotation and layout-image positioning, using the existing title_xref and title_yref behavior as a reference. Start by tracing how xref and yref options are handled for annotations and images, then compare that with title positioning relative to the container. Done means container is supported for both annotations and images without regressing axis or plotting-area placement; the fixed-pixel image-size question may need separate scope.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
data-visualization
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.