You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
zeroline is not visible when axis has no gridlines #4027
If you change nticks to: 0 | 3 | 3+ it is shown again.
Unfortunately I need to hide all the ticks except tick0 as this configuration will be used for subplots.
At present, we don't draw the ax.zeroline line on axes that don't have any visible grid lines associated with them e.g. as in the nticks: 1 or nticks: 2 cases you pointed out (note also that 0 isn't a valid nticks values, so you get the default ticks in that case).
I can't remember exactly why the ax._gridVals.length condition exists. We may consider changing it and honouring ax.zeroline: true no matter what, but that would have to be part of a major version update (e.g. in our v2 release).
changed the title [-]zeroline for X axis is not visible under some conditions[/-][+]zeroline is not visible when axis has no gridlines[/+]on Jul 11, 2019
My gut reaction is if zeroline gets coerced true, we should show it in these edge cases too, not just when it’s explicitly set true. Is there a case where that would look wrong?
Activity
etpinard commentedon Jul 11, 2019
Thanks for writing in!
At present, we don't draw the
ax.zerolineline on axes that don't have any visible grid lines associated with them e.g. as in thenticks: 1ornticks: 2cases you pointed out (note also that0isn't a validnticksvalues, so you get the default ticks in that case).The logic is here:
plotly.js/src/plots/cartesian/axes.js
Lines 2732 to 2745 in 323e79a
I can't remember exactly why the
ax._gridVals.lengthcondition exists. We may consider changing it and honouringax.zeroline: trueno matter what, but that would have to be part of a major version update (e.g. in our v2 release).[-]zeroline for X axis is not visible under some conditions[/-][+]zeroline is not visible when axis has no gridlines[/+]etpinard commentedon Jul 12, 2019
On second thoughts, I'm starting to think this report should be considered a bug (thanks @alexcjohnson )
Removing
plotly.js/src/plots/cartesian/axes.js
Line 2738 in 323e79a
does not make any of our tests fail.
The only problem I see is: as some axes
coerce('zeroline', true), according to the logic belowplotly.js/src/plots/cartesian/line_grid_defaults.js
Line 56 in 674f0b0
a "new" zeroline will appear on some graphs. Now I agree that:
should show the zeroline, even when it's on one of the plot area edges.
Would anyone be opposed to adding a
ax._input.zerolinecondition in here:alexcjohnson commentedon Jul 12, 2019
My gut reaction is if
zerolinegets coerced true, we should show it in these edge cases too, not just when it’s explicitly set true. Is there a case where that would look wrong?etpinard commentedon Sep 6, 2019
I'm going to slip in a fix for this bug i.e. by simply removing
plotly.js/src/plots/cartesian/axes.js
Line 2738 in 323e79a
in 1.50.0.
add failing mock for #4027
fix #4027 - show zeroline even when no grid lines are present