Interactive selection of series in a matplotlib plot

前端 未结 3 595
梦谈多话
梦谈多话 2020-12-31 13:43

I have been looking for a way to be able to select which series are visible on a plot, after a plot is created.

I need this as i often have plots with many series. t

3条回答
  •  清歌不尽
    2020-12-31 14:06

    It all depends on how much effort you are willing to do and what the exact requirements are, but you can bet it has already been implemented somewhere :-)

    If the aim is mainly to not clutter the image, it may be sufficient to use the built-in capabilities; you can find relevant code in the matplotlib examples library:

    • http://matplotlib.org/examples/event_handling/legend_picking.html
    • http://matplotlib.org/examples/widgets/check_buttons.html

    If you really want to have a UI, so you can guard the performance by limiting the amount of plots / data, you would typically use a GUI toolbox such as GTK, QT or WX. Look here for some articles and example code:

    • http://eli.thegreenplace.net/2009/05/23/more-pyqt-plotting-demos/

提交回复
热议问题