6
$\begingroup$

I have a matrix with a large amount of numbers in the rows.

matrix = Table[i + j, {i, 5}, {j, 30}];
matrix // MatrixForm

The problem is that my notebook is required to wrap everything up at paper length. The output matrix created by MatrixForm as a result does not show up complete in the notebook. Large amount of numbers are cut off. I was wondering how I could make the matrix appear completely in my notebook. Whether this is done by scaling the matrix size or changing font?

$\endgroup$

4 Answers 4

5
$\begingroup$

Whether this is done by scaling the matrix size or changing font?

One option is to use Style with specific font size of your choosing

matrix = Table[i + j, {i, 5}, {j, 30}];
Style[MatrixForm[matrix], 8]

enter image description here

$\endgroup$
4
$\begingroup$

You can use Pane[]:

matrix = Table[i + j, {i, 5}, {j, 30}];
Pane[matrix // MatrixForm, ImageSize -> Full, 
 ImageSizeAction -> "ShrinkToFit"]

enter image description here

$\endgroup$
2
$\begingroup$

It can also be done with Magnify or by giving the Magnification option to Style. Like so:

window

This method has the advantage that it works event if the items in the table are not textual.

colors

For those who feel the code needs to be posted in copyable form:

matrix = Table[i + j, {i, 5}, {j, 30}];

Magnify[matrix // TableForm, .55]

Style[matrix // TableForm, Magnification -> .55]

table = ConstantArray[Unevaluated[RandomColor[]], {2, 30}];

Magnify[table // TableForm, .6]
$\endgroup$
1
$\begingroup$

If there are too many numbers they become impossible to read anyway... how about using ArrayPlot?

matrix = Table[i + j, {i, 5}, {j, 30}];
ArrayPlot[matrix]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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