python - How do I get multiple scales for multiple subplots? -


i know multiple scales single plot can use:

fig, ax1 = plt.subplots() ax2 = ax1.twinx() ax1.plot(range(0,20,2)) ax2.plot(range(10)) 

however, need 4 subplots. when try like:

fig, ax = plt.subplots(nrows=2, ncols=2) row in ax:     col in row:         fig1, ax1 = col.subplots()         ax2 = ax2.twinx()         ax1.plot(range(0,20,2)         ax2.plot(range(10)) 

i error

'axessubplot' object has no attribute 'subplots' 

, makes sense, don't know how fix it.

in code question, col axes create twin axes, i.e. ax2 = col.twinx().

fig, ax = plt.subplots(nrows=2, ncols=2) row in ax:     col in row:         ax2 = col.twinx()         col.plot(range(0,20,2)         ax2.plot(range(10)) 

Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -