5
$\begingroup$

The Evaluation Preferences in Mathematica specify a maximum output size of 1048576 Bytes before truncation occurs. That makes a lot of sense when thinking about large lists of data, but is causes trouble when displaying large Graphics.

Here is an example. It is produced using version 9.0.1.0 on a MacBook Pro with Retina display running OS X 10.7.5. I'm importing a PDF file with a large polygon count.

Export["t1.pdf", Plot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2}]];
First@Import["t1.pdf"]

large output

This truncation warning does nothing to save space in the notebook, and the full output is in fact generated. So it would be nice if one could automatically suppress the truncation warning which serves no purpose here.

I don't think it's a valid solution to just increase the truncation Byte limit above its default value, because that would affect regular data output as well, and I don't want to increase the limit for that case.

Normally I would of course avoid exporting and importing PDF from 3D graphics, but it can't always be avoided if you have an external PDF file you'd like to display in the notebook.

$\endgroup$

1 Answer 1

4
$\begingroup$

This was the best I could do on short notice:

Export[FileNameJoin[{$HomeDirectory, "Desktop", "t1.pdf"}], 
  Plot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2}]

t1 = First@Import[FileNameJoin[{$HomeDirectory, "Desktop", "t1.pdf"}]];

Print[t1]

It's not elegant, but it does suppress the truncation warning.

$\endgroup$
4
  • $\begingroup$ Good work-around. $\endgroup$
    – Jens
    Commented Mar 2, 2013 at 18:45
  • $\begingroup$ @Jens. I was surprised to find that Block[{$OutputSizeLimit = 10^8}, t1] did not work, but a simple Print did. I wonder why Print is immune to output truncation? $\endgroup$
    – m_goldberg
    Commented Mar 2, 2013 at 18:55
  • 2
    $\begingroup$ @m_goldberg I don't think it's that surprising. Blockjust returns t1, which is then evaluated by the front end, where $OutputSizeLimit has the old value. $\endgroup$
    – Ajasja
    Commented Mar 2, 2013 at 20:23
  • $\begingroup$ @Ajasja. Of course. I wasn't thinking clearly. $\endgroup$
    – m_goldberg
    Commented Mar 3, 2013 at 1:43

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.