Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My PlotLabel goes beyond the width of the ImageSize. The label is generated into a List form by my program. I hope to allow my PlotLabel to go to a second, third, fourth (...) line if it reaches beyond the boundaries. My problem in simplified, working code:

testList = {1.1`, 1.2100000000000002`, 1.4641000000000004`, 
   2.143588810000001`, 4.594972986357221`, 21.1137767453526`, 
   445.7915684525922`, 198730.12250342217`, 3.949366159022518`*^10, 
   1.5597493058032278`*^21, 2.432817896953651`*^42, 
   5.918602919737985`*^84, 3.5029860521531003`*^169, 
678, 2.2672910032418008565810795918131168775255956636`15.\
10850, 4.8765899073587133585511396520327915438254972718`13.\
Plot[x^2, {x, -3, 3}, 
 PlotLabel -> StringForm["The orbit of x=1.1 is\n``\n", testList ], 
 ImageSize -> {600, 600}]

enter image description here

share|improve this question
up vote 10 down vote accepted

If you create a TextCell then it will wrap the list nicely. PageWidth controls the width of the text cell.

Plot[x^2, {x, -3, 3}, PlotLabel -> 
    StringForm["The orbit of x=1.1 is\n``\n", TextCell[testList, PageWidth -> 600]],  
    ImageSize -> {600, 600}]

enter image description here

You can change the appearance of the TextCell (font, fontsize, color, etc) using various options as shown in the help files for TextCell and Cell.

share|improve this answer
The copied code sends my list to two lines instead of one, but still goes beyond the viewable area. – twhoward99 Jun 5 '13 at 16:25
Above is the picture I got. You know.. if you play with the window width it changes the layout of the textcell. Maybe my default window width is different from yours... – bill s Jun 5 '13 at 16:27
Could I change the width of the TextCell? Its for a .cdf file and the output size needs to be constrained somewhat. – twhoward99 Jun 5 '13 at 16:32
See the change -- this one gives me the same picture, but now the width of the textcell is specified (and it doesn't change when you resize the window). – bill s Jun 5 '13 at 16:35
Works like a charm! Thank-you very much! – twhoward99 Jun 5 '13 at 16:40

Slightly better than my last attempt:

  Plot[x^2, {x, -3, 3}, ImageSize -> {400, 400}],
  Panel[testList, "The orbit of x=1.1 is", Top, 
   ImageSize -> {400, 120}]


share|improve this answer
Nice solution!! – twhoward99 Jun 5 '13 at 16:41

A nine-character solution: add ~Pane~600 to the end of the PlotLabel.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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