调整轴标签和刻度标签的大小后,pyqtgraph将它们重叠。下面的示例代码显示了yaxis标签和tick标签彼此显示。如何解决这个问题?
我尝试在AxisItem中设置tickTextWidth和tickTextHeight,但似乎不起作用。 (请参见下面的代码,注释掉的代码似乎没有任何作用)
import numpy as np
from pyqtgraph.Qt import QtGui, QtCore
import pyqtgraph as pg
app = QtGui.QApplication([])
x = np.linspace(-5, 5, 10000)
x2 = np.linspace(-1, 1, 10000)
y = x/10000 + x2/1000
win = pg.GraphicsWindow()
plot = win.addPlot(x=x, y=y, title="Plot")
label_style = {'color': '#EEE', 'font-size': '20pt'}
plot.setLabel('bottom', "some x axis label", **label_style)
plot.setLabel('left', "some y axis label")
plot.getAxis('left').setLabel(**label_style)
font=QtGui.QFont()
font.setPixelSize(20)
plot.getAxis("bottom").tickFont = font
plot.getAxis("bottom").setStyle(tickTextOffset=20)
plot.getAxis("left").tickFont = font
plot.getAxis("left").setStyle(tickTextOffset=20)
# plot.getAxis("left").setStyle(tickTextOffset=20, tickTextHeight=20, tickTextWidth=20)
if __name__ == '__main__':
import sys
if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
QtGui.QApplication.instance().exec_()
应该更改什么偏移量或内部设置?