Change the color of the labels of a PlotItem

909 views
Skip to first unread message

Wahabo Ouedraogo

unread,
Jan 16, 2021, 7:54:07 PM1/16/21
to pyqtgraph
Hi
how to change the color and font of axis and title labels in a PlotItem. 
thank you so much

Patrick

unread,
Jan 16, 2021, 9:50:44 PM1/16/21
to pyqtgraph
Hi,

Does AxisItem setTextPen() do what you want?

So something like this:
plot.getAxis("left").setTextPen((255, 0, 0))

Patrick

Wahabo Ouedraogo

unread,
Jan 16, 2021, 10:31:03 PM1/16/21
to pyqtgraph
no no, it is to change the color and font of the labels for example if we have displayed "time" on the x-axis and "temperature" on the y-axis ".
 How to change the color and font of the" time "labels and "temperature".
thank you.

Patrick

unread,
Jan 17, 2021, 1:23:51 AM1/17/21
to pyqtgraph
Oh OK, then you just want to pass some CSS style parameters when you call setLabel on either the PlotItem or AxisItem. What is not clear in the documentation is that the extra **args in PlotItem.setLabel get passed on to the AxisItem.setLabel, so you can use the same CSS styling parameters.

For example:
a_plotitem.setLabel("left", "temperature", color="#FF0000")

Wahabo Ouedraogo

unread,
Jan 18, 2021, 11:01:46 PM1/18/21
to pyqtgraph

Hi ! which function allows you to return the dialog box which allows you to export the graphics.Re: Change the color of the labels of a PlotItem
Capture.PNG
Reply all
Reply to author
Forward
0 new messages