我有 16 个子图,希望在每个子图中包含以下内容:
ax1.axvline(x=0.5, ymin=0.0, ymax=1.0, color='k', linestyle='--', alpha=0.3)
ax1.axhline(y=0.5, xmin=0.0, xmax=1.0, color='k', linestyle='--', alpha=0.3)
Run Code Online (Sandbox Code Playgroud)
运行一个循环来为所有子图提供它们似乎比使用 32 行更可行,但简单的字符串连接不起作用,例如
for i in xrange(1,17,1):
# then try to use i for each ax -- this isn't practical
Run Code Online (Sandbox Code Playgroud)
有什么建议么?
你已经把所有的东西都写好了...
from matplotlib import pyplot as plt
f, ax = plt.subplots(17)
for i in range(17):
ax[i].axvline(x=0.5, ymin=0.0, ymax=1.0, color='k', linestyle='--', alpha=0.3)
ax[i].axhline(y=0.5, xmin=0.0, xmax=1.0, color='k', linestyle='--', alpha=0.3)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9412 次 |
| 最近记录: |