I have been trying to plot axes above traces. This appears to be the default behavior (according to the documentation), and to be controlled by layout.xaxis.layer. Though, no matter the value of this property, it seems that the axes stay below the traces.
Minimal example:
import plotly.graph_objects as go
fig = go.Figure()
fig.add_trace(go.Scatter(x=[-1,2,3], y=[-3,4,5], mode='lines'))
fig.update_xaxes(layer="above traces")
fig.update_yaxes(layer="above traces")
fig.show()
Result: Example Plot
Plotly version: 5.8.0
Edit: The same happens if I use plotly.express.line for the plot and subsequently force the property assignment with update_xaxes.