'Matplotlib How to change length of line

Can you please help, how to change my code, so the red line will be longer and connect black point?

data.plot(kind = "scatter", x = "Pocet.potvrdenych", y = "Pocet.umrti")
plt.plot(x, model1.predict(x), color = "r", linewidth = 5)
plt.scatter(novi_potvrdeni, umrti, color="black")

Graph picture



Solution 1:[1]

Modify the second line to:

plt.plot(x + novi_potvrdeni, model1.predict(x) + umrti,
    color = "r", linewidth = 5)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Roman Pavelka