plotly / plotly/react-plotly.js

Axis `automarging` does not work

Open
#334 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1.1k
Forks
138
Avg merge
3d 2h
Merged PRs (30d)
4

Description

Hello,
I cannot get the Plotly.js automargin feature to work in React for axis ticks and labels.

Here is an example using official example:

// ...
var data = [
  {
    x: ['Apples', 'Oranges', 'Watermelon', 'Pears'],
    y: [3, 2, 1, 4],
    type: 'bar'
  }
];
var layout = {
  autosize: false,
  width: 500,
  height: 500,
  yaxis: {
    title: 'Y-axis Title',
    ticktext: ['long label','Very long label','3','label'],
    tickvals: [1, 2, 3, 4],
    tickmode: 'array',
    automargin: true,
    titlefont: { size:20 },
  },
};

  return (
    <div className="card-page">
        <Plot data={data} layout={layout}></Plot>
   </div>

What I get is this:
newplot

Am I missing a setting?

Contributor guide

No contributing guide indexed for this repository

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 issue names no repository file or test; begin by reproducing its inline JavaScript/React example with long y-axis tick labels and automargin enabled. Trace the resulting margin behavior and verify the result against the rendered example; done means the reported axis-label spacing issue is explained and corrected or clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
data-visualization, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.