0
$\begingroup$

I have:

enter image description here

created with:

With[{stdOpt = {InterpolationOrder -> 0, 
GridLines -> {Range[10], Range[10]}, 
GridLinesStyle -> Directive[GrayLevel[0.8], Dashed], 
Joined -> True, AspectRatio -> 1}}, 
ListPlot[{0}, stdOpt, PlotRange -> {{0, 10}, {0, 10}}, Axes -> False,
Frame -> False, Epilog -> {

Black, Opacity[1.0],

Text[Style[1, Large, FontFamily -> "Times"], {0.5, 0.5}, 
 FormatType -> Bold],
Text[Style[2, Large, FontFamily -> "Times"], {0.5, 1.5}, 
 FormatType -> Bold],
Text[Style[3, Large, FontFamily -> "Times"], {0.5, 2.5}, 
 FormatType -> Bold],
Text[Style[4, Large, FontFamily -> "Times"], {0.5, 3.5}, 
 FormatType -> Bold],
Text[Style[5, Large, FontFamily -> "Times"], {0.5, 4.5}, 
 FormatType -> Bold],
Text[Style[6, Large, FontFamily -> "Times"], {0.5, 5.5}, 
 FormatType -> Bold],
Text[Style[7, Large, FontFamily -> "Times"], {0.5, 6.5}, 
 FormatType -> Bold],
Text[Style[8, Large, FontFamily -> "Times"], {0.5, 7.5}, 
 FormatType -> Bold],
Text[Style[9, Large, FontFamily -> "Times"], {0.5, 8.5}, 
 FormatType -> Bold],
Text[Style[10, Large, FontFamily -> "Times"], {0.5, 9.5}, 
 FormatType -> Bold]

}]]

and I would like to place (& correctly align) a column of numbers (from pre-made lists) for each of the 10 columns (rather than the manully placed numbers as they appear above).

$\endgroup$

2 Answers 2

2
$\begingroup$

Random premade list:

SeedRandom@1;
m = 10; (* size of the grid *)
premade = RandomInteger[10, {m, m}];

column coordinates:

col[n_] := Table[{n - 0.5, i - 0.5}, {i, 1, m}]

And the wanted Graphics:

Graphics[
 {Table[
    Text[Style[premade[[#, i]], Large, FontFamily -> "Times"],col[i][[#]]] & /@ Range@m,
       {i, 1, m}]},
  GridLines -> {Range@m, Range@m}, PlotRange -> {{0, m}, {0, m}},
  Axes -> False, Frame -> True, GridLinesStyle -> Directive[GrayLevel[0.8], Dashed]]

enter image description here

$\endgroup$
6
  • $\begingroup$ @ Öskå, fantastic! - Just what I was after - super speedy reply too! :) $\endgroup$
    – martin
    Commented Nov 21, 2013 at 11:41
  • 1
    $\begingroup$ You are welcome :) Check the edit for your "for each of the 10 columns" part of your question :) $\endgroup$
    – Öskå
    Commented Nov 21, 2013 at 11:50
  • $\begingroup$ @martin do you still need the pink Rectangles? $\endgroup$
    – Öskå
    Commented Nov 21, 2013 at 12:02
  • $\begingroup$ @ Öskå, not just yet ;) $\endgroup$
    – martin
    Commented Nov 21, 2013 at 12:06
  • $\begingroup$ I can edit with a few more lines placing random rectangles if it helps $\endgroup$
    – Öskå
    Commented Nov 21, 2013 at 12:07
3
$\begingroup$
SeedRandom@1;
m = 10;(*size of the grid*)

premade = Map[Text[Style[#, Large, FontFamily -> "Times"]] &,  RandomInteger[10, {m, m}], {2}];
Grid[premade, Frame -> All, FrameStyle -> Dashed, ItemSize -> 2.5]

Mathematica graphics

$\endgroup$
1
  • $\begingroup$ @ belisarius, thanks for your 'slimmer' version (in terms of amount of code needed) - very useful from a learning point of view :) $\endgroup$
    – martin
    Commented Nov 21, 2013 at 16:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.