6
$\begingroup$

Often, with a Plot or within Manipulate I want to display a graph and, in close proximity to it, a table showing the results of relevant computations. The quickest way to do this is with GraphicsColumn, but that always seems to create cells of identical height and width, which is usually not what I want. Here is a trivial example:

Manipulate[
 GraphicsColumn[{Plot[Sin[x + c], {x, 0, 2*Pi}], 
   TableForm[{{c}}, TableHeadings -> {{"c"}, {"value"}}]}], {c, 0, 3}]

GraphicsColumn makes me sad

Is there some other convenient way to place the table below the graph without an ocean of whitespace, or a way to specify that GraphicsColumn can use cells of differing size?

$\endgroup$
5
$\begingroup$

You can use a normal Column:

Manipulate[Column[{Plot[Sin[x + c], {x, 0, 2*Pi}], Style[
    TableForm[{{c}}, TableHeadings -> {{"c"}, {"value"}}],
    FontFamily -> "Times"]},
  Center, 1], {c, 0, 3}]

Columns second argument lets you choose the alignment and the third one sets the spacing between elements. I also wrapped the TableForm into a Style[...] to change the font from "Courier" to "Times".

enter image description here

$\endgroup$
4
$\begingroup$

In some cases you might also want to insert the table within the figure using Epilog and Inset:

Manipulate[
 Plot[Sin[x + c], {x, 0, 2*Pi},
  Epilog -> 
   Inset[Style[
     TableForm[{{c}}, TableHeadings -> {{"c"}, {"value"}}], {Large, 
      Bold}], {5, .5}]], {c, 0, 3}]

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.