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

Scatter Plot axix is not remaining constant

Hello, I am building scatter plot . My Y axix values are from 0-1. When I am showing all records the values of y axix shows 0-1 range. But if i filter on some condition (Lets say for one customer and all the values are 0) and then y axix shows range from 0-1 and 0-1.
The x axix moves up. I want my x axix and Y axix remain constant.

layout= go.Layout(
title= ‘Feature Value Scatter Plot’,
hovermode= ‘closest’,
paper_bgcolor=‘rgba(0,0,0,0)’,
plot_bgcolor=‘rgba(0,0,0,0)’,
# margin = dict(t=40,b=10,l=10,r=10 ),
xaxis= dict(
title= ‘Risk Date’,
autotick=False,
ticklen= 5,
zeroline= True,
gridwidth= 2,
tickformat=’%Y-%m-%d’,
tickfont = dict(
size = 14,
color = “#000
),
# showline=True,
zerolinecolor=’#1E90FF’,
zerolinewidth=4,
# linecolor=’#1E90FF’,
# linewidth=5
showticklabels=True
),
yaxis=dict(
title= ‘Feature Value’,
zeroline = True,
autotick=True,
tickvals=[0.0,.2,.4,.6,.8,1.0],#[x/10.0 for x in range(0,10,2)],
ticktext=[x/10.0 for x in range(0,10,2)] ,#[‘January’, ‘February’, …]
# autogrid = True,
# title = “Tweets per Second”,
titlefont = dict(
size = 20,
color = “#000
),
tickfont = dict(
size = 14,
color = “#000
),
showticklabels=True,
showline=True,
linecolor=’#1E90FF’,
linewidth=3,
),
showlegend= True)

Have you tried setting xaxis.range = [0, 1] and yaxis.range = [0, 1]?

Yes. That worked for me.