Skip to content
Advertisement

pyqtgraph: How to add radiobuttons on a figure legend?

I want to control which curves are displayed at the figure by using the radiobuttons floating on the left-top corner, which will work also as a legend. How can I do that?

Advertisement

Answer

This could be achieved by inheiring pg.LegendItem and overriding addItem method. In it you need to create widgets and place them into layout. You can use QGraphicsProxyWidget to display QRadioButton on QGraphicsScene (PlotWidget).

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement