gpt4 book ai didi

python - Pyqtgraph plotwidget : cannot change font weight of axis ticks to BOLD

转载 作者:行者123 更新时间:2023-12-04 09:34:44 27 4
gpt4 key购买 nike

如何使 x 轴刻度加粗?

plot_1 = pg.PlotWidget()
plot_1.setBackground('w')
pen = pg.mkPen(color="k", width=3, style=QtCore.Qt.SolidLine)

plot_1 .setTitle("Title", color="k", size="18pt")
plot_1 .plot(xvals, yvals, pen=pen)
styles = {'color': 'r', 'font-size': '12px', 'font-weight': 'bold'}
plot_1 .setLabel('bottom', 'X label', **styles)

最佳答案

您必须使用 setTickFont()将字体设置为轴的方法:

fn = QtGui.QFont()
# fn.setPointSize(20)
fn.setBold(True)
plot_1.getAxis("bottom").setTickFont(fn)

关于python - Pyqtgraph plotwidget : cannot change font weight of axis ticks to BOLD,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62642579/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com