'Plotting one series from a pandas dataframe but displaying another as the axis label

Here is an example of my data:

enter image description here

What I'm trying to do is plot Voltage(V) (y axis) vs Step_Time(s) (x axis), and then display the row's Cycle_Index value as the x axis label. One approach I was considering was to hide the axis labels using matplotlib.pyplot.tick_params() and then doing a secondary axis using ax.secondary_xaxis(), however I haven't gotten that to work.

Is there a simpler way to do this? Thanks.



Sources

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

Source: Stack Overflow

Solution Source