MathGroup Archive 2002

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Table as Graphics Object?

  • To: mathgroup at
  • Subject: [mg35065] Re: [mg35027] Table as Graphics Object?
  • From: Andrzej Kozlowski <andrzej at>
  • Date: Thu, 20 Jun 2002 23:55:48 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

The method that I described produces only a bitmap graphic so I do not 
think it will scale well and look good at different image sizes, besides 
having the other disadvantages. If you really want something that works 
better, and judging by your message you do, you should make use of the 
Text primitive. It need not be so hard. Here is one simple example:

First we make a table of random number, say between 1 and 6:

ls = Table[Random[Integer, {1, 6}], {5}, {5}];

Next, we make a graphic "version" of the table. Note that there is no 
need to bother about the choice of text coordinates for such a simple 

myTable = GraphicsArray[Map[Graphics[Text[#, {0, 0}]] &, ls, {2}]];

Let's also make a 3D graphic using list plot and our matrix of values 

myGraphic = ListPlot3D[ls, DisplayFunction -> Identity];

Now we can display them side by side:

Show[GraphicsArray[{myGraphic, myTable}]]

This looks fine, will scale properly and can be automated to deal with a 
large number of different cases. Probably a variant of this approach 
will also work in your case.

Andrzej Kozlowski
Toyama International University

On Friday, June 21, 2002, at 03:10  AM, AES wrote:

> Thank you, and this is wonderful!  -- as a way of demonstrating the 
> kinds of complex things one can get led into with computers and 
> graphics, anyway.  I have all those tools, and may try this if I ever 
> need to put a table or something similar into a presentation graphic.
> What I'm currently doing, however, is running a program that takes in a 
> bunch of parameters and calculates a plot, and I want to run a lot of 
> cases and produce a single output for each that will include both the 
> plot and the long list of parameters that produced the plot. What I'm 
> doing currently is
> 	--Print a page break
> 	--Print a table of paramters
> 	--Print the plot (size of plot varies)
> 	--Repeat
> The object was to make this a little simpler, and maybe get two cases 
> per page, without more complex programming.
> So, seriously, I do appreciate your writing, but I don't clearly want 
> to follow all your steps 50 or 60 times!
> I'd be curious:  If you Show your "TableGraphic" several times at 
> different ImageSizes, do the fonts and characters scale neatly and look 
> good at different sizes?
> Thanks again,  Tony Siegman
> At 12:35 AM +0900 6/21/02, Andrzej Kozlowski wrote:
>> There is a trick you may wish to try. I just did it and it seems to 
>> work. You will need, besides Mathematica, a graphic program. There 
>> might be a clever trick that will make it possible to accomplish the 
>> same thing without one, but I have not found it.
>> Anyway,  this is what I just did under Mac OS X.
>> First, I created a table with:
>> Table[Random[Integer], {5}, {5}] // TableForm
>> I then selected the output and using the Cell/ConvertTo menu converted 
>> it to PICT, a Macintosh graphic format. (I expect other formats will 
>> also work). I then copied the graphic and pasted it into 
>> GraphicConverter, a well known Mac graphic program (any other such 
>> program will do). I then copied the graphic from GraphicConverted and 
>> pasted it back into Mathematica.  I selected the entire cell  and 
>> chose ConvertTo InputForm. You get a rather long expression which 
>> describes a graphic object (a RasterArray). Evaluate thsi cell, then 
>> evaluate myTable= %, and then Show[GraphicsArray[{myTable,myPlot}]] 
>> will give you just what you wanted.
>> This does not seem to work without using an external graphic program. 
>> Merely converting the Table first to a graphic and then into InputForm 
>> produces merely Mathematica input cell, not the input cell for a 
>> graphic object. It seems you have to force Mathematica to forget that 
>> your graphic was created by converting a Mathematica output cell.
>> Of course this gives you a raster graphic, which is not of the highest 
>> quality and rather large. If you want something better you really need 
>> to use the Text primitive.

>> On Thursday, June 20, 2002, at 03:13  PM, aes wrote:
>>> I'd like to include a Table as one of the objects in a
>>> GraphicsArray, using a simple syntax like
>>>  myTable = Table[---] // TableForm
>>>  myPlot = Plot[---]
>>>  Show[ GraphicsArray[ {{myTable, myPlot}} ]
>>> I know I could built a "psuedo Table" into a Graphics object using
>>> the usual Text[---] commands, but at the cost of a lot of work to
>>> input and position the various lines.
>>> Any other approaches?
>>> Thanks,  AES

  • Prev by Date: RE: Re: Friendly Challenge 2: sort by column
  • Next by Date: Re: Table as Graphics Object?
  • Previous by thread: RE: Table as Graphics Object?
  • Next by thread: Re: Table as Graphics Object?