I have a pandas pivot_table that I am plotting using matplotlib and I am trying to also plot a vertical line at a certain x coordinate. The interesting thing is I'm able to plot a horizontal line at a y coordinate without problem, doing the same for a vertical line plot is not working.
Panda pivot_table looks like the following...
Call Gamma Put Gamma
Strike
340.0 8.630821e+05 -2.908180e+07
345.0 3.740602e+05 -1.297854e+07
350.0 2.680039e+06 -3.798996e+07
355.0 1.733369e+06 -2.307662e+07
360.0 1.858877e+06 -2.335522e+07
365.0 2.475191e+06 -1.556776e+07
370.0 5.372839e+06 -6.969699e+07
372.0 2.453191e+06 -6.744016e+06
374.0 1.359576e+06 -4.797525e+06
375.0 1.258569e+07 -1.027296e+08
376.0 6.172461e+06 -6.335903e+07
377.0 6.433579e+06 -7.752972e+07
378.0 7.030789e+06 -1.727623e+08
379.0 4.256927e+06 -1.307386e+08
Here is the code I'm using to plot the pivot_table...
ax = mypivot.plot(figsize=(20, 5), kind='bar', stacked=True, title=name)
Here is the result of the above plot...
Now when I try to plot an additional vertical and horizontal line on top of the current figure, only the horizontal line works, here is the full code block...
ax = pivot.plot(figsize=(20, 5), kind='bar', stacked=True, title=name)
ax.axhline(y=-400000000, color='red')
ax.axvline(x=385, color='red')
I have a suspicion it's something to do with the Strike column in my pivot_table and indexing, but I can't figure it out for the life of me...please help...
Thanks!