MathGroup Archive 2003

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Graphics in Figure Caption

  • To: mathgroup at smc.vnet.net
  • Subject: [mg42253] Re: [mg41996] Graphics in Figure Caption
  • From: Omega Consulting <info at omegaconsultinggroup.com>
  • Date: Wed, 25 Jun 2003 01:53:49 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

At 02:56 AM 6/16/2003, Goyder Dr HGD wrote:
>Dear Mathgroup,
>
>How do I incorporate graphics symbols and lines into a caption for a figure?
>
>The standard presentation for a journal paper is a figure in a frame with
>the figure caption underneath containing a description of the lines on the
>figure. For example if we have one set of experimental data, dots, and three
>models, solid lines, dashed lines and chain dashing the plot could be
>constructed as follows
>
>
>SetOptions[ListPlot,Frame\[Rule] True,Axes\[Rule]False,PlotRange \[Rule]All,
>TextStyle\[Rule]{FontFamily->"Times",FontSize\[Rule]10}];
>SetOptions[Plot,Frame\[Rule] True,Axes\[Rule]False,PlotRange \[Rule]All,
>TextStyle\[Rule]{FontFamily->"Times",FontSize\[Rule]10}];
>
>data= Table[{x,ArcTan[x-5] + Random[]/5},{x,0,10,0.5}];
>
>p0 =ListPlot[data,Prolog\[Rule]{PointSize[0.02]}, DisplayFunction \[Rule]
>Identity];
>
>p1=Plot[ArcTan[x-3],{x,0,10},DisplayFunction \[Rule] Identity];
>
>p2=Plot[ArcTan[x-4],{x,0,10},PlotStyle\[Rule]{Dashing[{0.01,0.01}]},
>DisplayFunction \[Rule] Identity];
>
>p3=Plot[ArcTan[x-6],{x,0,10},PlotStyle\[Rule]{Dashing[{0.01,0.01,0.001}]},
>DisplayFunction \[Rule] Identity];
>
>Show[p0,p1,p2,p3,FrameLabel\[Rule]{"Time / sec","Difficulty /
>m"},DisplayFunction \[Rule] $DisplayFunction];
>
>
>Underneath the graph I would like the following caption.
>
>
>Figure 8. Comparison of experiment with theory: ??dot dot dot??,
>experimental results; ??solid line??, theoretical model 1 Park (2001);
>??dashed line??, theoretical model 2 Kuska (2002); ??chain dash??
>theoretical model 3 Hanlon (2003).
>
>
>where the items ??dot dot dot??, ??dashed line?? etc are actually a line of
>dots and a dashed line. The graphics for these dots and lines should be the
>same size as in the diagram and centred with the text.
>
>Thanks for examples and ideas.
>
>Hugh Goyder

Some frontend programming makes this possible:

We need a command that creates a graphic as an inline cell of the size we want.

GraphicsCell[gr_] :=
   Cell[GraphicsData["PostScript",
       DisplayString[
         Graphics[gr, ImageSize->20, PlotRange->{{-1.5, 1.5},All}]]]]

Then we insert those inline cells into a normal cell. I think a table (i.e. 
a GridBox) works well in this case.

CellPrint[Cell[BoxData[GridBox[{
           {"Figure 8.","Comparison of experiment with theory:"},
           {GraphicsCell[{PointSize[.02*12], Point/@{{-1,0},{0,0},{1,0}}}],
             "experimental results"},
           {GraphicsCell[{Line[{{-1,0},{0,0},{1,0}}]}],
             "theoretical model 1 Park (2001)"},
           {GraphicsCell[{Dashing[{0.01,0.01}*8], Line[{{-1,0},{0,0},{1,0}}]}],
             "theoretical model 2 Kuska (2002)"},
           {GraphicsCell[{Dashing[{0.01,0.01,0.001}*8],
                 Line[{{-1,0},{0,0},{1,0}}]}],
             "theoretical model 3 Hanlon (2003)"}
           }]], "Text"]]

Note that the pointsizes and dashings are not exactly the same as in the 
graph. That's because PointSize and Dashing are relative sizes. They're 
only going to be the same if the images are the same size. To get the same 
points and dashes, you should use AbsolutePointSize and AbsoluteDashing.

--------------------------------------------------------------
Omega Consulting
"The final answer to your Mathematica needs"
http://omegaconsultinggroup.com


  • Prev by Date: RE: Compile Module w/ Function inside?
  • Next by Date: Have Equal problems whith Flat attribute?
  • Previous by thread: Graphics in Figure Caption
  • Next by thread: Transfering Packages from Windows to Mac