matplotlib - I am trying to plot a 5*2 plot in python -


i trying plot set of graphs in python using code below.

fig = plt.figure(figsize=(12,8)) ax1 = fig.add_subplot(521) fig = sm.graphics.tsa.plot_acf(s0, lags=40, ax=ax1) ax2 = fig.add_subplot(522) fig = sm.graphics.tsa.plot_pacf(s0, lags=40, ax=ax2)  fig = plt.figure(figsize=(12,8)) ax1 = fig.add_subplot(523) fig = sm.graphics.tsa.plot_acf(s1, lags=40, ax=ax1) ax2 = fig.add_subplot(524) fig = sm.graphics.tsa.plot_pacf(s1, lags=40, ax=ax2)  fig = plt.figure(figsize=(12,8)) ax1 = fig.add_subplot(525) fig = sm.graphics.tsa.plot_acf(s2, lags=40, ax=ax1) ax2 = fig.add_subplot(526) fig = sm.graphics.tsa.plot_pacf(s2, lags=40, ax=ax2)  fig = plt.figure(figsize=(12,8)) ax1 = fig.add_subplot(527) fig = sm.graphics.tsa.plot_acf(s3, lags=40, ax=ax1) ax2 = fig.add_subplot(528) fig = sm.graphics.tsa.plot_pacf(s3, lags=40, ax=ax2)  fig = plt.figure(figsize=(12,8)) ax1 = fig.add_subplot(529) fig = sm.graphics.tsa.plot_acf(s4, lags=40, ax=ax1) ax2 = fig.add_subplot(5210) fig = sm.graphics.tsa.plot_pacf(s4, lags=40, ax=ax4) 

there error in line have plotted 10th subplot , 10th subplot not getting displayed in output. code follows

ax2 = fig.add_subplot(5210) fig = sm.graphics.tsa.plot_pacf(s4, lags=40, ax=ax4) 

and error message follows

integer subplot specification must 3 digit number. not 4

i think problem (5210).the first 2 digit specify rows , columns of graphs i.e 52 means 5 columns , 2 rows, total of 10 graphs , 3rd digit refers placement number i>e 1,2,3,...10. things work fine upto (529) shows error in (5210).

5210 gives error because naively expects 3-digit integer. issue cannot parse whether mean "5 rows, 2 columns, 10th plot" or "5 rows, 21 columns, 0th plot", etc.

you can around separating numbers commas , using each separate agrument. is:

ax2 = fig.add_subplot(5, 2, 10) 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -