Black Lives Matter. Please consider donating to Black Girls Code today.

Ticks away from the borders when height is large

Dear plotly.js,
Hello! I find if the plot height is very large, then there is a white region between the top line and first tick (same for the bottom):

This is a test example:
https://codepen.io/anon/pen/rGJWZR?editors=0010

I wonder is there any way to remove the white region and bring the ticks closer to the borders? Thank you!

Here’s how: https://codepen.io/etpinard/pen/PJQpPg?editors=0010

1 Like

Wow, that’s very easy fix and works great, thank you @etienne!

1 Like

Dear @etienne,
The solution you posted works very well when I got a lot of levels, but if I have less levels, the ticks on the y axis will not be centered:

https://codepen.io/anon/pen/rGJWZR?editors=0010

If I remove the “range”, it will be centered. I wonder how can I make it centered and avoid the white region issue at the same time? Thank you!

Using some other scale factor than 0.1 should do the trick.

You can also subscribe to https://github.com/plotly/plotly.js/issues/1876 for the latest development info.

1 Like