Math Figure

Hi, I use matplotlib for a math modelling software.

    > I would like to create a figure, using the mathtext
    > module, that would consist entirely of a list of
    > equations.

    > This figure would be embedded in WX.

    > can anyone give me some pointer on how to get started?

First port mathtext to wx <wink>. There are two ways to do this:

  * Write WXAgg: This is easier than you think.

  * Use the image_as_str method that ft2font provides to get a pixel
    array from the math fonts and transfer them to the wx canvas using
    the wx API. Something like draw_from_rgba. I don't know WX very
    well. Is there a WX method that allows you to draw from a
    character buffer or array?

Jeremy earlier expressed some interest in WXAgg but I don't know what
the current status of that is.

After that is done, we can move on to your question. Hint: see
examples/alignment_test.py for examples of laying out just text using
0,1 coords.

JDH

Hi John,

I'm (slowly) getting around to doing all of the things needed to bring
backend_wx up to date (as far as possible). backend_wxagg will arrive, but
I'm trying to get some other things into backend_wx first, specifically:

- Support for images (which is turning out to be trickier than I thought)
- Support for the object picker (which should be easy)
- Support Mathtext

The problem of Mathtext support is a superset of the image support problem.

The approach which I'm looking at is to use wxImage, which has a fast
method for loading data (wxImage.SetData()) - ths expects a C string of
length width*height*3 (in format RGBRGBRGB...).

Not sure what format im.as_str() returns as I can't find any documentation
(the im parameter to RendererWx.draw_image() is an instance of
matplotlib.image, I assume), so I'm stuck (or was a couple of nights ago).

As you say, writing wxAgg is really pretty straightforward, and it's on my
(ever lengthening) ToDo list... At the moment I don't have anything in a
usable state.

Regards

Jeremy

John Hunter said:

···

"Flavio" == Flavio Codeco Coelho <fccoelho@...18...>
writes:

    > Hi, I use matplotlib for a math modelling software.

    > I would like to create a figure, using the mathtext
    > module, that would consist entirely of a list of
    > equations.

    > This figure would be embedded in WX.

    > can anyone give me some pointer on how to get started?

First port mathtext to wx <wink>. There are two ways to do this:

  * Write WXAgg: This is easier than you think.

  * Use the image_as_str method that ft2font provides to get a pixel
    array from the math fonts and transfer them to the wx canvas using
    the wx API. Something like draw_from_rgba. I don't know WX very
    well. Is there a WX method that allows you to draw from a
    character buffer or array?

Jeremy earlier expressed some interest in WXAgg but I don't know what
the current status of that is.

After that is done, we can move on to your question. Hint: see
examples/alignment_test.py for examples of laying out just text using
0,1 coords.

JDH