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

标签 python pyqt5 pyqtgraph

我正在尝试将样式设置为 pyqtgraph.PlotWidget 绘图区域的轴。我正在使用:

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

myPlotWidget.getAxis('left').setPen('b')
myPlotWidget.getAxis('left').setFont(font)
我不明白为什么刻度标签颜色不是蓝色,而轴、网格和轴标签是蓝色。
enter image description here

最佳答案

您需要使用 AxisItem.setTextPen() 明确地:

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

关于python - 如何在 PyQt5 中设置 PlotWidget 刻度颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62720981/

相关文章:

python - 更快地附加 Pandas 系列的有序频率

python - QTableView 选择更改时出错

python - 如果 pyqtgraph 在 GUI 中,则它没有交互模式

python - 如何为 Django 项目创建模拟 LDAP 服务器?

python - 使用 Python 仅获取网页中链接列表的第一个元素

python - 在 QTextEdit 上设置鼠标指针光标

python - Pyqt5 为什么我的图像加载为 PNG 而不是 JPG?

python - PyQtGraph : how to change size (height and width) of graph in a ScrollArea

python - 如何在一个进程中连续多次启动 pyqt GUI?

python - 多个同名的外部包