plt.plot() usually accepts x,y and format. But if I pass third argument as data another line is plotted. I can't understand the relationship.
x=np.linspace(0,10,5)
plt.plot(x,x,x,label='linear')
plt.grid()
Created plot:

This page of the docs outlines the call signatures for matplotlib.pyplot.plt(). Specifically relevant here is the signature
plot([x], y, [fmt], [x2], y2, [fmt2], ..., **kwargs)
And the parameter description
x, y: array-like or scalar
The horizontal and vertical components of the data points.
xvalues are optional and default torange(len(y)).
When you do something like
plt.plot(x,x,x)
You are actually specifying a first set of x values followed by the corresponding y values and then a second set of y values which are paired with the default x values of range(len(y)) and plotted, resulting in two lines.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With