Plotly Express Line Chart extra one month space and hover text

Q1. How can I remove that extra space ?
I did set the range_x from “2021-01-01” to “2021-12-31”, but it still have some empty space

Q2. How can I format the hover text to “Registration Month = November, 2021” ?

TIA

The space you see corresponds to November. As you last data point seems to be the 1st of November you see the remaining days.

An example:

import pandas as pd
import numpy as np
import plotly.graph_objects as go

x = pd.date_range(
    start ='1-1-2021', 
    end ='31-12-2021', 
    freq ='d'
)

y = np.random.randint(0,20,size=len(x))

fig = go.Figure(
        go.Scatter(
        x=x,
        y=y,
        mode='markers+lines'
    )
)

fig.update_xaxes(range=(x[0], x[-1]))
fig.show()