更改matplotlib中绘图的轴,标记和标签的颜色
问题描述:
我想更改轴的颜色,以及使用matplotlib和PyQt绘制的绘图的标记和值标签。
I'd like to Change the color of the axis, as well as ticks and value-labels for a plot I did using matplotlib an PyQt.
任何想法
答
作为一个快速示例(使用比潜在重复的问题更清晰的方法):
As a quick example (using a slightly cleaner method than the potentially duplicate question):
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(range(10))
ax.set_xlabel('X-axis')
ax.set_ylabel('Y-axis')
ax.spines['bottom'].set_color('red')
ax.spines['top'].set_color('red')
ax.xaxis.label.set_color('red')
ax.tick_params(axis='x', colors='red')
plt.show()