Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use larger font size for axis ticks #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions GraphWidgetPyQtGraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def __init__(self, config, reactor, cxn = None, parent=None):
def initUI(self):
self.tracelist = TraceList(self)
self.pw = pg.PlotWidget()
self._set_axes_font(20)
if self.vline_name:
self.inf = pg.InfiniteLine(movable=True, angle=90,
label=self.vline_name + '{value:0.0f}',
Expand Down Expand Up @@ -106,6 +107,22 @@ def initUI(self):

self.pw.scene().sigMouseMoved.connect(self.mouseMoved)
self.pw.sigRangeChanged.connect(self.rangeChanged)

def _set_axes_font(self, font_size):
font = QtGui.QFont()
font.setPixelSize(font_size)
left_axis = self.pw.plotItem.getAxis("left")
left_axis.tickFont = font
left_axis.setWidth(font_size * 7)
left_axis.setStyle(tickTextOffset=font_size/2)
left_axis.setStyle(textFillLimits=[(0, 0.6), (2, 0.4),
(4, 0.2), (6, 0.0)])
bottom_axis = self.pw.plotItem.getAxis("bottom")
bottom_axis.tickFont = font
bottom_axis.setHeight(font_size * 2)
bottom_axis.setStyle(tickTextOffset=font_size/2)
bottom_axis.setStyle(textFillLimits=[(0, 0.6), (2, 0.4),
(4, 0.2), (6, 0.0)])

def getItemColor(self, color):
color_dict = {"r": QtGui.QColor(QtCore.Qt.red).lighter(130),
Expand Down