wxList and FigureCanvasWx

Hello -- I'm having a dickens of a time getting this to

    > work...

I totally understand. A more extensive users guide is sorely needed.
There is just so much to do on the development front that I haven't
made time for it.

    > I believe I understand what you mean about maintaining
    > a list of FigureCanvasAggs and using string & bitmap
    > methods to get the figures into my wxDialog.

    > Where I'm stuck is in plotting a histogram to a
    > FigureCanvasAgg... I've checked out your examples, but
    > there doesn't appear to be anything that directly uses
    > FigureCanvasAgg. I've tried many different ways (mostly
    > based on the embedded_in_wx.py and histogram_demo.py
    > examples).

    > Based on the example "histogram_demo.py" could you
    > please give some pointers as to how to plot the
    > histogram to a FigureCanvasAgg? I think I can handle
    > things after that...

The example is included below. I'll add it to the examples dir for
people who want to work directly with the Agg canvas and renderer.

Let me know if you need some more help. Note that after you get the
RGB string from Agg, you may want to destroy the figure and canvas if
the figure is static to conserve memory.

As repayment, if you have a nice screenshot showing your application
in action, with the list box and figures etc, that I can include on
the screenshots page, send it my way.

from matplotlib.backends.backend_agg import FigureCanvasAgg
from matplotlib.figure import Figure
from matplotlib.axes import Subplot
from matplotlib.mlab import normpdf
from matplotlib.numerix import randn

fig = Figure(figsize=(5,4), dpi=100)
ax = Subplot(fig, 111)
canvas = FigureCanvasAgg(fig)

mu, sigma = 100, 15
x = mu + sigma*randn(10000)

# the histogram of the data
n, bins, patches = ax.hist(x, 50, normed=1)

# add a 'best fit' line
y = normpdf( bins, mu, sigma)
line, = ax.plot(bins, y, 'r--')

ax.set_title(r'$\rm{Histogram of IQ: }\mu=100, \sigma=15$')

ax.set_xlim( (40, 160))
ax.set_ylim( (0, 0.03))


s = canvas.tostring_rgb() # save this and convert to bitmap as needed