plotly / plotly/plotly.js

enable positioning of horizontal legend below xaxis label

Open
#6,720 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I want to put a (long) legend horizontally and below the xaxis.

But I have some trouble with positioning.

  1. By default, the legend runs into the axis label (see Fig. below).
  2. Putting the legend below the xaxis seems to require some guessing for a negative y (or are the better ways?
Plotly.newPlot('graph', [
   {  y: [2, 1, 3]},
   {  y: [4, 2, 5]},
   {  y: [3, 3, 6]},
  ],
  {xaxis: {title: {text: 'axis label'}},
           legend: {title: {text: 'legend title'},
                    orientation: 'h'}
  }
)

grafik

https://jsfiddle.net/5udmbkza

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 supplied JSFiddle and reproduce the horizontal legend below the x-axis label using the Plotly.newPlot configuration in the issue. Trace how legend and axis-label layout are positioned, then verify that long horizontal legends can be placed below the x-axis without overlap or manual negative-y guessing.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.