Black Lives Matter. Please consider donating to Black Girls Code today.
Learn how to use COVID-19 data in open source Dash apps. Register for the Sept 23rd webinar with IQT!

Is it possible to have multiple Y axis 0(zero) positions in same line?

Hi,

I have 3 different Y axis’s (Left, center, right) and 1 X-Axis. Three Y-Axis’s sharing one X-Axis which is fine and now these three Y-Axis’s have three different 0 positions (plotting in different locations). I need all 3 Y-Axis 0 positions in one line. i tried with range[-10,10], it is effecting to all 3 axis’s but i need three separate behaviors for all Y-Axis’s. Is there any way to do that?

Thanks.

I’m not 100% sure what you’re looking for (a screenshot would help).

Two potential solutions:

  • use new axis attribute matches
  • note that axis.position cannot be negative, so to place an axis to the left of the default y-axis, you need to set xaxis.domain[0] to something greater than 0, to leave room for additional axes.

I found the solution for alignment https://github.com/plotly/plotly.js/issues/1845#issuecomment-491514150. Also i need all Y-Axis’s grid lines in same position. is there any way to do that?

Did you figure out how to do this @vlearns19 ?

@rolandow @vlearns19

I’ve crafted a comprehensive solution. This was fairly rushed, so if there are any mistakes or confusions, please do let me know

Wow, that is a great answer @VictorBezak. I must admit I already abandoned plotly because I found the documentation of this project is far behind. I think you can do anything with Plotly if you’re as talented as you. There are graphing alternatives though that do this heavy math for you.

But, I really appreciate your efforts, so I wanted to thank you anyways. I will get back to plotly in the future to see if with newer versions I can accomplish of my requirements. For now, my audience was getting anxious, so I had to deliver results. Your code and explanation is really impressive.

@rolandow I appreciate your comment, sir. I’m curious what graphing alternatives you found to be more effective for you use-case? I’ve only had the opportunity to experiment with one other graphing library, and personally found Plotly’s documentation to be far more organized and thorough.

Also, if you plan to implement this example code, please note that it’s currently only reliable for positive y-axis values greater than 1. I’m still working on the code that nicely covers all cases of fractional and negative values. I’ll follow up when it’s complete

I think advertisement will not be appreciated here, so I PM’ed you.

I’m also curious on what’s the graphing alternatives you mentioned.

Thanks!