Force axis labels to redraw

32 views
Skip to first unread message

Bertram Gilfoyle

unread,
Mar 20, 2020, 2:34:01 AM3/20/20
to pyqtgraph
I have instances where the X axis labels are not updated. In a custom AxisItem tickStrings is being called and produce the correct axis labels but are not updated on the chart. I call generateDrawSpecs in the end to make sure there's an update but still nothing. The correct labels are only displayed when changing the range.
Is there any way to force a redrawing of the axis labels?

Patrick

unread,
Mar 21, 2020, 12:15:27 AM3/21/20
to pyqtgraph
Hi,

I don't think this has anything to do with your custom tickStrings etc, it happens with stock pyqtgraph too. I've never dug far enough to find out why, but it's like if you enable autorange, but that doesn't require a redraw, then when data is added to the plot (which does appear in correct location and scale etc) then axes labels don't get updated to match. I work around this in a few different ways depending on how my plots are initialised/used/reset, but in general I think it's either by explicitly calling a manual autoRange after enableAutoRange or by calling setRange if I know what the initial axes ranges should be.

Patrick

Bertram Gilfoyle

unread,
Mar 24, 2020, 12:00:13 PM3/24/20
to pyqtgraph
Hey,

Thanks so much. I was pulling hair for days over this and a simple call to autoRange seems to do it. Unsure if useful but in my case the problem only occurs if the X data point count (time period in my case) is the same as previous.
Reply all
Reply to author
Forward
0 new messages