GridPlotContainer using component_grid

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

GridPlotContainer using component_grid

Henry Gomersall
>From the docs, I'm told that when using a GridPlotContainer, using the
component_grid property "is the preferred way of setting and reading its
contents" (http://docs.enthought.com/chaco/api/containers.html#gridplotcontainer)

Unfortunately, I'm having some difficulty in actually making this work
as expected.

Attached is a modified version of grid_plot_container.py from
examples/user_guide in which the adding of the elements to the container
is done using all in the indices of component_grid, rather than with the
add() method. The result is a blank grey window.

Could someone advise what I'm doing wrong?

Alternatively, how do I put plots in some, but not all of the positions
in the grid (specifically, how do I specify which position is used to
add a plot).

Cheers,

Henry

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

grid_plot_container.py (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: GridPlotContainer using component_grid

Peter Wang-2
Hey Henry,

Sorry no one responded to this earlier.  I looked at your code and the
fix is very simple: you need to actually add each plot to the
container.  It is not sufficient to just set its position in the
component_grid.  So if you just add the line:

    container.add(plot)

before modifying the component_grid, you will see that your example now works.

HTH,
Peter


On Wed, Apr 3, 2013 at 9:20 AM, Henry Gomersall <[hidden email]> wrote:

> >From the docs, I'm told that when using a GridPlotContainer, using the
> component_grid property "is the preferred way of setting and reading its
> contents" (http://docs.enthought.com/chaco/api/containers.html#gridplotcontainer)
>
> Unfortunately, I'm having some difficulty in actually making this work
> as expected.
>
> Attached is a modified version of grid_plot_container.py from
> examples/user_guide in which the adding of the elements to the container
> is done using all in the indices of component_grid, rather than with the
> add() method. The result is a blank grey window.
>
> Could someone advise what I'm doing wrong?
>
> Alternatively, how do I put plots in some, but not all of the positions
> in the grid (specifically, how do I specify which position is used to
> add a plot).
>
> Cheers,
>
> Henry
>
> _______________________________________________
> Enthought-Dev mailing list
> [hidden email]
> https://mail.enthought.com/mailman/listinfo/enthought-dev
>
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: GridPlotContainer using component_grid

Henry Gomersall
On Thu, 2013-04-11 at 09:30 -0500, Peter Wang wrote:
> Sorry no one responded to this earlier.  I looked at your code and the
> fix is very simple: you need to actually add each plot to the
> container.  It is not sufficient to just set its position in the
> component_grid.  So if you just add the line:
>
>     container.add(plot)
>
> before modifying the component_grid, you will see that your example
> now works.

Thanks for that :)

I imagine the enthought guys have been busy with Canopy recently.

Henry

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