Axis Ticks not flushed with Graph Border
I am having some frustration trying to figure out (searching, trial and error) how to flush Plotly axis and the zero tick.
here is my code:
import plotly.go_objects as go
fig = go.Figure()
fig.add_trace(
go.Scatter(
x=x,
y=y,
name=label,
mode="markers",
marker=dict(size=10),
opacity=0.5,
)
)
fig.update_layout(
font_family="Arial",
template="simple_white",
title={"x": 0.5, "y": 0.9, "xanchor": "center", "yanchor": "top"},
yaxis=dict(mirror=True, ticks="outside", range=[0, 1]),
xaxis=dict(mirror=True, ticks="outside"),
legend=dict(
yanchor="top", xanchor="right", borderwidth=0.5, x=0.995, y=0.99
),
)
Same issue here trying to plot with ticks = 'outside' and it does not seem to be an issue with the theme/template as some people have said. Adjusting the axis position leads to several graphical errors as well (especially with mirrored axes) and isn't a solution. I think the problem may actually be with the axis drawing and not the ticks. The high end is also misaligned not just near tick0.
This is a very serious issue in my opinion these graphs are not publication quality with such alignment errors.
I see your point, but there's an argument to be made that the current behavior is actually more correct: the zero tick mark is pointing at the value zero, while the bottom axis line is bordering the chart on the outside. Since the axis is intended to go to zero, that means the top of the axis line should be at the middle of the zero tick mark. If the two were aligned, that would mean the axis line is covering up the very bottom of the axis.
I was going to suggest that if what you want is a line centered on zero, use the zero line instead of the axis line. Unfortunately that has other artifacts that I would definitely consider to be bugs: the y axis line stops slightly short of flush with the bottom of the zero tick mark, and the x axis tick marks have a gap with the zero line.
