question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Multiple y axes -> only one scatter shows up

See original GitHub issue

Issue

When plotting data on multiple Y axes, particularly when nothing is plotted on the primary Y axis, sometimes plotly will only show one series.

Repro

https://codepen.io/jasoncurtis/pen/zmqNMQ?editors=0010

Expected behavior

Two series are plotted.

Actual behavior

Two series show up in the legend, but only one series is plotted.

Workaround

If you change 'y2' in the repro code above to ‘y1’, both series will show up. However, it’s not always reasonable to assume there will be data on y1 - I am trying to write a purpose-specific API that uses plotly in such a way that I cannot guarantee there will be something on y1 without significant extra complexity.

Related:

  • I filed plotly/plotly.py#1200 for this and was referred here since this is a plotly.js issue.
  • it appears that this issue may have been the source of #1970 which was closed because @alexmon’s repro did not work.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
alexcjohnsoncommented, Oct 5, 2018

If you want to ensure yaxis is always drawn, put a dummy invisible trace on it, like {visible: false} (which will implicitly be drawn on xaxis and yaxis). If you don’t want to see yaxis, just have it there to be overlaid on, you can make it too visible: false https://codepen.io/alexcjohnson/pen/oazbvv?editors=0010

0reactions
Tunnellercommented, Apr 20, 2022

This discussion was incredibly useful to help me debug why I was not getting curves on my plots. You mean that ‘overlapping: “y”’ is not short-hand for ‘overlapping: “yes”’… I spent 24 sleep deprived hours on this. Now that I’ve got it all working, everything makes sense. And that solution was to simply insert {visible: false}. Wow. So neat. Er… is this in the documentation yet?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Plotly two Y axes: how to show one dataset as a linechart and ...
I want the data displayed in the second Y axis to be a scatter plot instead of a line. Is there a way...
Read more >
Scatterplot with two y-axis in Excel - YouTube
It's pretty straight forward to make a scatterplot in Excel. But what if you want to plot 2 y - axis variables? In...
Read more >
Multiple axes in Python - Plotly
How to make a graph with multiple axes (dual y-axis plots, plots with secondary axes) in python ... Scatter(x=[1, 2, 3], y=[40, 50,...
Read more >
Create Chart with Two y-Axes - MATLAB & Simulink
This example shows how to create a chart with y-axes on the left and right sides using the yyaxis ... Now when you...
Read more >
Add or remove a secondary axis in a chart in Excel
Learn to add a secondary axis to an Excel chart. ... The scale of the secondary vertical axis shows the values for the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found