Hi everyone, I have a question about how I can change axis linewidth, axis font and axis ticks style... for each plot in the example belowHave you some example about that?
Oddly enough I came here to ask about the axis font style. I can use html to change the title and axes using setTitle or setLabel and <font size="5">AxisLabel</font>, but the font size of the units on the axes don't change and I would like to set the font size in pixels. On the title, it works withsetTitle('Title',size='10px')but if I try a similar thing withsetLabel('bottom','BottomAxisLabel',size='10px')the axis label disappears until I clear the plot.
well there is one way to directly change the font size for an axis item:
b.setPixelSize(20)
x_axisitem.tickFont = b
fontForTickValues = QtGui.QFont()
fontForTickValues.setPixelSize(50) fontForTickValues.setBold(True) def addUpperLowerGraphs(self): self.upperName = self.l2.addLabel(vmicText) self.axis = TimeAxisItem('bottom') self.axis.setStyle(tickFont = fontForTickValues) self.axis.setPen(axisPen) self.upperGraph = self.l2.addPlot(name = "upper") self.upperGraph.showGrid(x=True,y=True) self.upperGraph.setContentsMargins(0.0,20.0,0.0,0.0) self.l2.nextRow()
self.lowerName = self.l2.addLabel(quraText) self.lowerGraph = self.l2.addPlot(name = "lower",axisItems={'bottom':self.axis})
I believe there is a padding parameter that you have to modify to push text away from axis. I don't have access to my code currently but I'll update tomorrow if you haven't got it by then.
--
You received this message because you are subscribed to a topic in the Google Groups "pyqtgraph" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pyqtgraph/jS1Ju8R6PXk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pyqtgraph+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyqtgraph/f774fbd5-8077-4bc7-b446-89b70d8b7227%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
w1 = pg.PlotWidget()
w1.plot(X,Y)
labelStyle = {'color': '#FFF', 'font-size': '14px'}
w1.setLabel('bottom', 'X', **labelStyle)
w1.setLabel('left', 'Y', **labelStyle)
w1.getAxis('bottom').setHeight(int(14 * 1.7 + 5))
w1.getAxis('left').setWidth(int(14 * 2.6 + 8))
It's kind of kluge-y but it works. The formula inside of the setHeight and setWidth is just something I came up with after experimenting to keep the text away from the axis. It only works over a certain range of font sizes.
Hello Justin,I will be very glad if you share your solution.
--
You received this message because you are subscribed to a topic in the Google Groups "pyqtgraph" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pyqtgraph/jS1Ju8R6PXk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pyqtgraph+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyqtgraph/e617c941-f9b1-4fd1-9f93-ce7d527d0500%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyqtgraph/CADFmkEtL7HUirmXXYr_XGydyw4T6ye8c-1d2KHHo9DUBPYDVgQ%40mail.gmail.com.