我有一个图形,
fig
plt.gca().get_lines()[0].set_color("Green")
这能如你所愿吗?
plt.gca().get_children()[0].set_color("green")
[编辑] 这是我使用的完整代码和结果截图。
import matplotlib.pyplot as plt import numpy as np data = np.random.randn(100) plt.hist(data) plt.gca().get_children()[0].set_color("green") plt.show()