Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Graphics array formatting

I'm computing a number of plots (actually collections of 2d polygons) of roughly square aspect ratio, and would like to display them in a reasonable way:

  • use two columns
  • preserve order
  • title each of them
  • adjust the size to fill the width of my notebook, disregarding the height

First I displayed each graphics as it arrived, or combined bunches of them into graphics_array in order to show them. But my sage notebook (the classical one, not the IPython flavor) failed to preserve order in that case. So I feel that I have to build one big graphics_array.

But I've got trouble adjusting its width without specifying its height, and I don't know a suitable height up front. Most of the times if I specify one of the sizes too large, I end up with lots of empty space in one of the directions.

Furthermore, I didn't manage to title the individual graphics, since a title attribute to the polygon2d call remains without effect, while a title attribute to the show affects the whole plot and all the nested plots. Constructing an empty Graphics(title="foo") doesn't seem to work.

This is on sage 6.10.beta4, so things might have improved since then. If so, I haven't yet found the appropriate locations in the online documentation indicating how this changed.

Graphics array formatting

I'm computing a number of plots (actually collections of 2d polygons) of roughly square aspect ratio, and would like to display them in a reasonable way:

  • use two columns
  • preserve order
  • title each of them
  • adjust the size to fill the width of my notebook, disregarding the height

First I displayed each graphics as it arrived, or combined bunches of them into graphics_array in order to show them. But my sage notebook (the classical one, not the IPython flavor) failed to preserve order in that case. So I feel that I have to build one big graphics_array.

But I've got trouble adjusting its width without specifying its height, and I don't know a suitable height up front. Most of the times if I specify one of the sizes too large, I end up with lots of empty space in one of the directions.

Furthermore, I didn't manage to title the individual graphics, since a title attribute to the polygon2d call remains without effect, while a title attribute to the show affects the whole plot and all the nested plots. Constructing an empty Graphics(title="foo") doesn't seem to work.

This is on sage 6.10.beta4, so things might have improved since then. If so, I haven't yet found the appropriate locations in the online documentation indicating how this changed.

If you want to try this out: I wanted to format the output of this code but using two columns and a varying number of rows for each n.