Re: Print[Plot] vs Print[text,Plot]?
- To: mathgroup at smc.vnet.net
- Subject: [mg87954] Re: Print[Plot] vs Print[text,Plot]?
- From: Helen Read <hpr at together.net>
- Date: Mon, 21 Apr 2008 03:25:28 -0400 (EDT)
- References: <fueep7$bai$1@smc.vnet.net>
- Reply-to: HPR <read at math.uvm.edu>
AES wrote:
> I've just executed a test cell containing
>
> Print[Plot[---]];
> Print["Some text\n", Plot[---]];
>
> (same simple plot in both lines; objective of 2nd line being to get the
> text and the plot -- eventually several plots -- into the same output
> cell)
You do not need print for this. Here are some ways to do it using
PlotLabel or Labeled, and GraphicsRow, GraphicsColumn, or GraphicsRid.
Plot[Sin[x], {x, 0, 2 \[Pi]}, PlotLabel -> "Some text"]
Labeled[Plot[Sin[x], {x, 0, 2 \[Pi]}], "Some text", Top]
Labeled[Plot[Sin[x], {x, 0, 2 \[Pi]}], "Some text", Bottom]
GraphicsRow[{Plot[Sin[x], {x, 0, 2 \[Pi]}, PlotLabel -> "Plot 1"],
Plot[Cos[x], {x, 0, 2 \[Pi]}, PlotLabel -> "Plot 2"]}]
Labeled[GraphicsGrid[{{Plot[Sin[x], {x, 0, 2 \[Pi]},
PlotLabel -> "Plot 1"],
Plot[Cos[x], {x, 0, 2 \[Pi]}, PlotLabel -> "Plot 2"]},
{Plot[Tan[x], {x, 0, 2 \[Pi]}, PlotLabel -> "Plot 3"],
Plot[Cot[x], {x, 0, 2 \[Pi]},
PlotLabel -> "Plot 4"]}}], "My plots", Top]
Incidentally, you will usually get better answers here if you post
specific Mathematica code that others can copy/paste into a notebook and
execute, so that they don't have to make up examples for you.
--
Helen Read
University of Vermont