更改matplotlib中绘图的轴,标记和标签的颜色 [英] Changing the color of the axis, ticks and labels for a plot in matplotlib

查看:3359
本文介绍了更改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()

这篇关于更改matplotlib中绘图的轴,标记和标签的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆