problem with multiple figures and mlab.text()

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

problem with multiple figures and mlab.text()

Martin Luessi
Hi,

I'm trying to add text to multiple mlab figures, but for some reason
the text is always added to the last figure. For example

f1 = mlab.figure()
mlab.test_contour_surf()

f2 = mlab.figure()
mlab.test_surface()

mlab.text(0.5, 0.5, 'test', figure=f1)

Adds the text to the 2nd figure. The same thing happens if I replace
the last line with

mlab.figure(f1)
mlab.text(0.5, 0.5, 'test')

On the other hand, other drawing functions draw into f1 after setting
"mlab.figure(f1)". Is this a bug in mlab.text() or am I doing
something wrong? I appreciate your help.

Best,

Martin

PS: I am using EPD 7.2 with mayavi 4.1.0
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: problem with multiple figures and mlab.text()

Gael Varoquaux
On Sat, Jun 23, 2012 at 05:47:56AM -0400, Martin Luessi wrote:
> On the other hand, other drawing functions draw into f1 after setting
> "mlab.figure(f1)". Is this a bug in mlab.text() or am I doing
> something wrong? I appreciate your help.

It's a bug. Technically I know where it comes from (basically, mlab.text
needs to find an object on which to apply the text, and it fails to find
an object on the right figure).

In practice, to get rid of the problem, make sure that you call mlab.text
right after adding an object to the figure that you are interested in.

Also, could you please open an issue.

Gael
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: problem with multiple figures and mlab.text()

Martin Luessi
On Sat, Jun 23, 2012 at 5:57 AM, Gael Varoquaux
<[hidden email]> wrote:
> It's a bug. Technically I know where it comes from (basically, mlab.text
> needs to find an object on which to apply the text, and it fails to find
> an object on the right figure).

Thanks for clarifying this.

> In practice, to get rid of the problem, make sure that you call mlab.text
> right after adding an object to the figure that you are interested in.

Unfortunately, for what I am trying to do this is not really an
option. I was working on adding support for multiple figures to
PySurfer (http://pysurfer.github.com). The user should be able to add
text to figures in no particular order. Do you have any pointers on
how this could be fixed in MayavVi? I would be happy to help and then
backport the solution to PySurfer, such that it works correctly with
MayaVi 4.1.0.

> Also, could you please open an issue.

here you go: https://github.com/enthought/mayavi/issues/38
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: problem with multiple figures and mlab.text()

Martin Luessi
On Sat, Jun 23, 2012 at 7:53 AM, Martin Luessi <[hidden email]> wrote:

> Unfortunately, for what I am trying to do this is not really an
> option. I was working on adding support for multiple figures to
> PySurfer (http://pysurfer.github.com). The user should be able to add
> text to figures in no particular order. Do you have any pointers on
> how this could be fixed in MayavVi? I would be happy to help and then
> backport the solution to PySurfer, such that it works correctly with
> MayaVi 4.1.0.
>
>> Also, could you please open an issue.
>
> here you go: https://github.com/enthought/mayavi/issues/38

My first attempt on fixing this issue is here:

https://github.com/mluessi/mayavi/tree/multifig_text

Unfortunately, it still doesn't work. find_figure_engine() finds the
right engine, but the text still gets added to the wrong figure.

I also post this on the github issue referenced above, it is probably
better to continue the discussion there.
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: problem with multiple figures and mlab.text()

Gael Varoquaux
Hi Martin,

Sorry for not helping you with that. I am thrilled that you are tackling
this problem, but I am leaving for a conference tomorrow, and I have a 2
hours long tutorial to give, ... that is not ready.

I'll try hard to have a look at what you are doing. No promises, though!

Thanks heaps,

Gael
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: problem with multiple figures and mlab.text()

Martin Luessi
On Sun, Jun 24, 2012 at 4:30 AM, Gael Varoquaux
<[hidden email]> wrote:
> Sorry for not helping you with that. I am thrilled that you are tackling
> this problem, but I am leaving for a conference tomorrow, and I have a 2
> hours long tutorial to give, ... that is not ready.
>
> I'll try hard to have a look at what you are doing. No promises, though!
>
> Thanks heaps,
>
> Gael

You're welcome. Don't worry, it's not an urgent issue. Maybe I will
even figure out how to really fix it before you have time to look at
it ;).

Best,

Martin
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev