Add multiple plots monthwise on same graph

341
December 23, 2016, at 3:13 PM

I need to plot a line plot in matplotlib with different line representing different month

I have the code:

if(month=='12'):
cursor=cnx.cursor()
query="Select q1,q2,q3,q4,q5,q6,q7,q8,q9,q10 from table where month_id=12;"
cursor.execute(query)
result=list(cursor.fetchall())
for i in result:
    dec=list(i)
for rank, column in enumerate(majors):    
    ax.plot(dec,    
            lw=2.5, color=tableau20[rank])
if(month=='01'):
cursor=cnx.cursor()
query="Select q1,q2,q3,q4,q5,q6,q7,q8,q9,q10 from table where month_id=1;"
cursor.execute(query)
result=list(cursor.fetchall())
for i in result:
    jan=list(i)
for rank, column in enumerate(majors):    
    ax.plot(jan,    
            lw=2.5, color=tableau20[1])

But when I change the month to january .the plot for month 12 vanishes and plot for january comes up..I need both of the plots to be on same graph.Please help me with this.

Rent Charter Buses Company
READ ALSO
Python only prints the last list in a 2d list [duplicate]

Python only prints the last list in a 2d list [duplicate]

This question already has an answer here:

326
how do I use pyplot to display data when a breakpoint is hit in LLDB

how do I use pyplot to display data when a breakpoint is hit in LLDB

I successfully can run a python script when a breakpoint is hitAs explained here I make a python module implementing my function with this signature:

411
python selenium cant iterate through elements

python selenium cant iterate through elements

Trying to iterate though a list of elements by the index of a classEach attempt the index doesnt increase

468
Python Twython script crashes while in a permanent while loop

Python Twython script crashes while in a permanent while loop

So, I wrote a Python script that posts a tweet to Reddit when a specific person tweets something newI have it running continuously with a while loop, but eventually it just returns this error message:

610