'Irregular subplots in matplotlib python3
I plotted 3x4 subplots and I would like to add one more - to the first row (for instance to the position 1 4. How to do that, please? I tried the comment lines and I obtain an error:
AttributeError: 'numpy.ndarray' object has no attribute 'set_xlim'
Code:
import numpy as np
import matplotlib.pyplot as plt
fig, ((ax1, ax2, ax3, ax4), (ax5, ax6, ax7, ax8), (ax9, ax10, ax11, ax12)) = plt.subplots(nrows=3, ncols=4, figsize=(12,7))
#fig, ((ax0), (ax1, ax2, ax3, ax4), (ax5, ax6, ax7, ax8), (ax9, ax10, ax11, ax12)) = plt.subplots(nrows=4, ncols=4, figsize=(12,7))
for ax in [ax1, ax2, ax3, ax4, ax5, ax6, ax7, ax8, ax9, ax10, ax11, ax12]:
#for ax in [ax0, ax1, ax2, ax3, ax4, ax5, ax6, ax7, ax8, ax9, ax10, ax11, ax12]:
ax.set_xlim(0,1000)
ax.ticklabel_format(useOffset=False)
plt.show()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
