5

I saw the following example:

Embedding a matplotlib figure inside a WxPython panel

I got the example to work, however, is there a way to make the chart/plot interactive such as the one that is produced by:

http://matplotlib.sourceforge.net/examples/pylab_examples/finance_demo.html

The latter has a zoom, pan functionality which is what I would like to embed in my GUI.

1 Answer 1

3

I got this working...

    chart_toolbar = NavigationToolbar2Wx(chart_canvas)
    tw, th = chart_toolbar.GetSizeTuple()
    fw, fh = chart_canvas.GetSizeTuple()
    chart_toolbar.SetSize(wx.Size(fw, th))
    chart_toolbar.Realize()

    graphs_sizer = wx.BoxSizer(wx.VERTICAL)

    graphs_sizer.Add(chart_canvas, 20, flag=wx.EXPAND, border=5)
    graphs_sizer.Add(chart_toolbar, 1, flag=wx.ALIGN_CENTER, border=5)

    graphs_panel.SetSizer(graphs_sizer)

For whatever reason I have not been able to put the toolbar on a different sizer/panel. Otherwise it works. If someone can get it on a different sizer, that would be greatly appreciated.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.