8
$\begingroup$

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, 
   1.22709112815791634686748164742131068419446205954341`15.\
653559774527023*^339, 
   1.50575263680386788043945221511499961813146`15.352529778863042*^\
678, 2.2672910032418008565810795918131168775255956636`15.\
051499783199061*^1356, 
   5.1406084933812118223464178513329285`14.75046978753508*^2712, 
   2.64258556822230525123173280428744040060801405497404`14.\
449439791871098*^5425, 
   6.98325848537680392124060228920952089211156`14.148409796207117*^\
10850, 4.8765899073587133585511396520327915438254972718`13.\
847379800543136*^21701};
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

$\endgroup$
10
$\begingroup$

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.

$\endgroup$
  • $\begingroup$ The copied code sends my list to two lines instead of one, but still goes beyond the viewable area. $\endgroup$ – twhoward99 Jun 5 '13 at 16:25
  • $\begingroup$ 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... $\endgroup$ – bill s Jun 5 '13 at 16:27
  • $\begingroup$ Could I change the width of the TextCell? Its for a .cdf file and the output size needs to be constrained somewhat. $\endgroup$ – twhoward99 Jun 5 '13 at 16:32
  • $\begingroup$ 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). $\endgroup$ – bill s Jun 5 '13 at 16:35
  • $\begingroup$ Works like a charm! Thank-you very much! $\endgroup$ – twhoward99 Jun 5 '13 at 16:40
7
$\begingroup$

Slightly better than my last attempt:

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

panel

$\endgroup$
  • $\begingroup$ Nice solution!! $\endgroup$ – twhoward99 Jun 5 '13 at 16:41
4
$\begingroup$

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

$\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.