Course Name: Options Trading Strategies In Python: Basic, Section No: 1, Unit No: 15, Unit type: Notebook
In [4] : I am not able to understand:
ax.spines
ax.plot
Also how does the Y-axis is at zero position.
If someone can please elaborate or explain it a little bit.
Thank You.
Hi Mridul,
The plot method is used to plot the line graph. It takes the element of x and y as input parameters.
ax.plot(sT, payoff_long_call, label='Call option buyer payoff')
In the above code, we passed stock price (sT) and long call payoff (payoff_long_call) as x and y-axis respectively to plot. We also passed the label of the plot using the label parameter.
The spines method is used to adjust the location and appearance of axes.
ax.spines['bottom'].set_position('zero')
The above code makes the x-axis intersect the y-axis at 0.0.
If you change the code to
ax.spines['bottom'].set_position('centre')
Then it draws the x-axes such that it intersects the y-axes in its centre.