Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"matches" attribute interfering with autorange #5095

Closed
kricka91 opened this issue Aug 24, 2020 · 2 comments
Closed

"matches" attribute interfering with autorange #5095

kricka91 opened this issue Aug 24, 2020 · 2 comments

Comments

@kricka91
Copy link

kricka91 commented Aug 24, 2020

When I use two matching axes in my diagram, autorange doesn't seem to work properly.

<head>
	<!-- Load plotly.js into the DOM -->
	<script src='https://cdn.plot.ly/plotly-latest.min.js'></script>
</head>
<body>
	<div id='myDiv'><!-- Plotly chart will be drawn inside this DIV --></div>
</body>
var trace0 = {
  x: [0,1,2],
  y: [1,2,1],
  //y: [-2,3,8],
  yaxis:"y"
}

var data = [
  trace0,
  {yaxis: "y2"}
]

var layout = {
    width: 800,
    title: "matches interfering with autorange",
    yaxis2: {
      matches: "y",
      side: "right",
      overlaying: "y",
    },
}

Plotly.newPlot('myDiv', data, layout)

The range should automatically adapt to the y values and be around [1,2] (+ some margin), but it instead becomes [-1,4], which I believe is some hard coded default range. When I change the y values to below -1 and/or above 4, the autorange is computed correctly and extends to a larger range to fit all the points. When the matches attribute is removed, or when the empty data set linked to the second y axis is removed, the autorange works also for the original smaller range.

@nicolaskruchten
Copy link
Contributor

@alexcjohnson is this resolved in #5287 ?

@alexcjohnson
Copy link
Collaborator

Good call @nicolaskruchten - This is indeed resolved by #5287 🎉 I can reproduce the issue on the latest release (eg at https://rreusser.github.io/plotly-mock-viewer/) but if I build off master the autorange is done correctly.

@kricka91 we expect make a new release this week including this fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants