简体   繁体   English

如何在 PyQt5 中设置 PlotWidget 刻度颜色?

[英]How to set the PlotWidget Tick Color in PyQt5?

I'm trying to set the style the axis of a pyqtgraph.PlotWidget plotting area.我正在尝试将样式设置为 pyqtgraph.PlotWidget 绘图区域的轴。 I'm using:我在用着:

font = QFont()
font.setPointSize(14)
font.setBold(True)
font.setWeight(75)

myPlotWidget.getAxis('left').setPen('b')
myPlotWidget.getAxis('left').setFont(font)

and I don't understand why the tick label color is not blue while the axis, grid and axis labels are.我不明白为什么勾选 label 颜色不是蓝色,而轴、网格和轴标签是蓝色。

在此处输入图像描述

You need to use AxisItem.setTextPen() explicitly:您需要明确使用AxisItem.setTextPen()

self.graphWidget.getAxis('left').setTextPen('b')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM