'Matplotlib Plot X, Y Line Plot Multiple Columns Fixed X Axis

I'm trying to plot a df with the x axis forced to 12, 1, 2 for (Dec, Jan, Feb) and I cannot see how to do this. Matplot keeps wanting to plot the x axis in the 1,2,12 order. My DF (analogs_re) partial columns for the example looks like this:

   Month      2000      1995      2009      2014      1994      2003  
0     12 -0.203835  0.580590  0.233124  0.490193  0.605808  0.016756   
1      1 -0.947029 -1.239794 -0.977004  0.207236  0.436458 -0.501948   
2      2 -0.059957  0.708626  0.111840  0.422534  1.051873 -0.149000

I need the y data plotted with x axis in 12, 1, 2 order as shown in the 'Month" column.

My code:

fig, ax = plt.subplots()
#for name, group in groups:
analogs_re.set_index('Month').plot(figsize=(10,5),grid=True)
analogs_re.plot(x='Month', y=analogs_re.columns[1:len(analogs_re.columns)])

enter image description here



Sources

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

Source: Stack Overflow

Solution Source