Re: Combining graphics and tabels in one cell
- To: mathgroup at smc.vnet.net
- Subject: [mg52468] Re: Combining graphics and tabels in one cell
- From: AES/newspost <siegman at stanford.edu>
- Date: Sun, 28 Nov 2004 01:06:54 -0500 (EST)
- References: <co97t9$guk$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
In article <co97t9$guk$1 at smc.vnet.net>,
"Bruyndonckx P." <pbruynd at vub.ac.be> wrote:
> I have a two-dimensional matrix which I want to display using BarChart3D and
> TableForm. However, I would like
> them to appear side-by-side in one output cell. Is there a way to combine a
> graphical object and a non-graphical
> object in one cell (ie equivalent to GraphicsArray for two graphical objects)
> ?
>
> Peter
>
I don't claim to be a Mathematica expert, but the following works for me
as an understandable way to convert text stuff, including perhaps a
Table, into a graphic that can then be joined with other graphics:
g1 = Graphics[{
Text[
StyleForm[
SequenceForm[
"Some title string\n",
TableForm[
Table[<<some table stuff>>]]],
FontFamily -> "Helvetica",FontSize->9, FontWeight -> "Bold"],
{0.5, 0.5},{0, 0}]}]
The Graphics[ ] part of course creates a graphic.
The Text[] part creates a text block within the graphic
The StyleForm[ ] part lets you set the font family, size, etc.,
of the text stuff and the Table in that text block
The SequenceForm[ ] is necessary to combine the multiple text stuff,
including text strings and Tables, as sequential arguments to
StyleForm[].
The numbers in the final line position the total block of text stuff
centered in the graphic.
You can then use Show[g1] to create a graphic which can be one of the
graphics in your GraphicsArray.
I use this same template, combined with Show[g1], to create "title
slides" for Mathematica animations. The title and all of the numerical
and other data for a given animation are inserted into g1, which becomes
the first graphic in a notebook, followed by any number of graphic cells
for the animation itself. I can then easily auto-select and animate all
of the graphics cells, or use Save Selection to make a QuickTime movie,
with the title slide as the opening slide.
The one weakness of this approach is that the text block doesn't scale
if you change the size of the graphic. You have to pick a font size and
font weight that makes the text block fit properly within the size of
the graphic g1, as determined by ImageSize.