0
我想迭代matplotlib.axes.AxesSubplot的数组,重新调用pandas.DataFrame.hist来使每个子记录logy。下面的示例代码不起作用迭代对象数组python
from pandas import DataFrame
import numpy as np
import matplotlib.pyplot as plt
x = np.random.uniform(0, 100, size=1000)
y = x *x + 50*x*np.random.randn(1000)
z = x * y + 50*y*np.random.randn(1000)
frame = DataFrame({'z' : z,'x' : x , 'y' : y})
Histograms = frame.hist(bins=50)
for axis in np.nditer(Histograms,"refs_ok"):
axis.set_yscale("log", nonposy='clip')
plt.show()
“以下示例代码不起作用” - >这是什么意思?你有任何错误?或意想不到的输出(你期望输出什么)? –
“不起作用”总是意味着“没有按照我的预期行事”,但我们不知道你的期望。所以请说出你的期望,并描述你所得到的观察结果。 – Alfe
对不起,我得到的这个版本的“ValueError:迭代器全局标志必须是一个列表或字符串元组”。 – Keith