plotly / plotly/plotly.js

Feature Request: Add vertical spacing option between plot and rangeslider

Open
#7,510 0 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

Hi Plotly team ,

I'm working with rangeslider in a dual-axis layout (xaxis + xaxis2, yaxis2), and I’d like to request a feature that allows more control over the vertical spacing between the plot area and the rangeslider.

In the current setup, the rangeslider always appears directly below the main plot and sometimes the labels are inside the rangeslider.

Screenshot of plotly figure

The definition of the layout is:

function staticLayout(): object {
  
  return {
    margin: {l: 70, r: 20, t: 10, b: 20},
    showlegend: true,
    legend: {
      orientation: 'h',
      x: 0,
      y: 1.02,
      yanchor: 'bottom',
    },
    xaxis: {
      domain: [0.0, 1.0],
      anchor: 'y',     
      side: 'bottom',    
      title: {
        text: 'Time (s)',
        standoff: 15
      },
      automargin: true,
      rangeslider: {
        visible: true,
        thickness: 0.07,
        bgcolor: "#f5f5f5",
        bordercolor: "black",
        borderwidth: 1,
      },
      showticklabels: false,
      showgrid: false,
      zeroline: false,
      fixedrange: true,
    },
    yaxis: {
      visible: false,
      showticklabels: false,
      showgrid: false,
      zeroline: false,
      showline: false,
      overlaying: 'y2',
    },
    xaxis2: {
      anchor: 'y2',      
      side: 'bottom',    
      // type: 'log',
      ticklabelposition: 'outside',
    },
    yaxis2: {
      anchor: 'x2',
      zeroline: false,
      showticklabels: true,
      ticklabelposition: 'outside',
    }
  };
}

How can I fix the spacing?

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 by reproducing the supplied dual-axis layout with xaxis.rangeslider and the screenshot’s label-overlap behavior. Trace where the plot-to-rangeslider spacing is determined, then define the requested spacing option and verify that the example separates the plot and rangeslider without placing labels inside it.

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
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.