# Building a 1 page "Scorecard" in mathematica [closed]

I'd like to be able to generate an 11 x 8.5 "scorecard" for various data projects I am working on. Traditionally, I'd import all my data into Excel, put the data into worksheets, and then have a worksheet for this scorecard which would contain headers, tables, and graphics. I'd then print to PDF this worksheet.

Ideally it would have two or three columns of data, for different lines of business for instance. Again this would be pretty easy in Excel because I could just manually align them.

Here's an ASCII art of what I have in mind:

+-------------------------------------+
| scorecard                           |
|-----------|------------|------------|
|           |            |            |
| table     | table      |  chart     |
| 1 2 3     | 1 2 5      |  xxxxx     |  8.5 in
| x y z     | x a b      |  xxxxx     |
|           |            |            |
| chart     |            |            |
| +++++++   |            |            |
| +++++++   |            |            |
|           |            |            |
+-------------------------------------+
11 inches


I'd like to move this process to Mathematica for many reasons, but haven't found a great way to combine all these things. I've tried something like the below code, which makes some charts and puts them into a Grid and exports that grid.

h1=RandomReal[{1,20},200];
h2=RandomReal[{1,20},300];
his1=Histogram[h1];
his2=Histogram[h2];
meanDiff=Mean[h1]-Mean[h2]
output=Grid[his1,his2,meanDiff]
Export["~/Desktop/output.pdf",output,ImageSize->{11.0,8.5}*72]


However, the PDF it generates is not a full page and it includes the Grid[] code in there. I feel like Mathematica probably has some easy way to generate this using a combination of Grid, Column, Row, GraphicsGrid, or Show but I haven't been able to figure out the magic sauce. Please help point me in the right direction!

• Try output = Grid[{{his1, his2, meanDiff}}] or output=Grid[List /@ {his1, his2, meanDiff}]?
– kglr
Apr 8, 2015 at 21:20
• Apr 9, 2015 at 8:20

You need to set the size of the elements of the scorecard. Have a look at Histogram's ImageSize option. Also you can set your tables in Grid or TableForm wrapped in a Pane or Panel to get them the size you want as well. They have ImageSize options as well.

To help with the ImageSize parameters make use of UnitConvert to convert from your know dimensions in "Inches" to the printer dimensions of "DesktopPublishingPoints".

QuantityMagnitude@UnitConvert[Quantity[3, "Inches"], "DesktopPublishingPoints"]


It is a bit long so setup a function for it

inchesToPrinterPoints[x_ /; x >= 0] :=
QuantityMagnitude@UnitConvert[Quantity[x, "Inches"], "DesktopPublishingPoints"]


Now you can use inchesToPrinterPoints in the ImageSize option parameters.

Hope this helps.