What I did:
fig = make_subplots(
rows=2, cols=2,
)
fig.add_trace(
go.Scatter(x=fpr, y=tpr, mode='lines', name='Receiver Operating Characteristic', line=go.scatter.Line(color="blue")),
row=1, col=1
)
fig.add_trace(
go.Scatter(x=[0, 1], y=[0, 1], mode='lines'),
row=1, col=1
)
fig.add_trace(
go.Scatter(x=thresholds, y=tpr, mode='lines', name='tpr', line=go.scatter.Line(color="blue")),
row=1, col=2
)
fig.add_trace(
go.Scatter(x=thresholds, y=fpr, mode='lines', name='fpr', line=go.scatter.Line(color="red")),
row=1, col=2
)
fig.update_xaxes(
range=[0,1],
dtick=0.2,
autorange=False,
)
fig.update_yaxes(
range=[0,1],
dtick=0.2,
autorange=False,
scaleanchor='x',
scaleratio=1,
)
fig.update_layout(
width=800,
height=800,
margin={'t': 0, 't': 0, 'r': 0, 'l': 0, },
)
fig.show()
Essentially the axes ranges on the canvas were intended to be set exactly within [0, 1]
, however It actually seemed to put an extra strip at both the top and bottom of the plot, as illustrated in the attachment. Is there any way to get a plot where both axes show the exact ranges as specified?