(*********************************************************************** Mathematica-Compatible Notebook This notebook can be used on any computer system with Mathematica 4.0, MathReader 4.0, or any compatible application. The data for the notebook starts with the line containing stars above. To get the notebook into a Mathematica-compatible application, do one of the following: * Save the data starting with the line of stars above into a file with a name ending in .nb, then open the file inside the application; * Copy the data starting with the line of stars above to the clipboard, then use the Paste menu command inside the application. Data for notebooks contains only printable 7-bit ASCII and can be sent directly in email or through ftp in text mode. Newlines can be CR, LF or CRLF (Unix, Macintosh or MS-DOS style). NOTE: If you modify the data for this notebook not in a Mathematica- compatible application, you must delete the line below containing the word CacheID, otherwise Mathematica-compatible applications may try to use invalid cache data. For more information on notebooks and Mathematica-compatible applications, contact Wolfram Research: web: http://www.wolfram.com email: info@wolfram.com phone: +1-217-398-0700 (U.S.) Notebook reader applications are available free of charge from Wolfram Research. ***********************************************************************) (*CacheID: 232*) (*NotebookFileLineBreakTest NotebookFileLineBreakTest*) (*NotebookOptionsPosition[ 58425, 1356]*) (*NotebookOutlinePosition[ 59078, 1379]*) (* CellTagsIndexPosition[ 59034, 1375]*) (*WindowFrame->Normal*) Notebook[{ Cell[CellGroupData[{ Cell["\<\ Various Routines for Making Vertically Aligned Graphics Plots\ \>", "Title"], Cell["\<\ David Park djmp@earthlink.net http://home.earthlink.net/~djmp/\ \>", "Subtitle"], Cell[TextData[{ "Many users of ", StyleBox["Mathematica", FontSlant->"Italic"], " wish to make a vertical stack of graphics, using GraphicsArray, but find \ it difficult to obtain alignment of the x-axes when the plots have a common x \ range. This problem arises because ", StyleBox["Mathematica", FontSlant->"Italic"], " does not quite give the user full control of spacing around plots. This \ is illustrated in the section on Small AspectRatios. " }], "Text"], Cell[TextData[{ "Tom Wickham-Jones writes in his book ", StyleBox["Mathematica", FontSlant->"Italic"], " ", StyleBox["Graphics", FontSlant->"Italic"], StyleBox[": \"The disadvantage [of the ", FontVariations->{"CompatibilityType"->0}], StyleBox["Mathematica", FontSlant->"Italic", FontVariations->{"CompatibilityType"->0}], StyleBox[" method] is that it is not possible to set the mapping of the \ graphic onto the page from within ", FontVariations->{"CompatibilityType"->0}], StyleBox["Mathematica", FontSlant->"Italic", FontVariations->{"CompatibilityType"->0}], StyleBox[". This would make it possible to do things like line up \ sub-pictures in a GraphicsArray, something that is hard to do at present. It \ is hoped that a future version of ", FontVariations->{"CompatibilityType"->0}], StyleBox["Mathematica", FontSlant->"Italic", FontVariations->{"CompatibilityType"->0}], StyleBox[" will add this capability, taking care to maintain the existing \ functionality.\"", FontVariations->{"CompatibilityType"->0}] }], "Text"], Cell["\<\ In this notebook I present three routines, AlignedGraphicsPlots, \ AlignedGraphicsPlots2 and VerticalPlots, for making a vertical stack of \ aligned plots. AlignedGraphicsPlots is best if only two of three functions \ are to be compared. It employs ideas put forward by Bob Hanlon. \ Unfortunately, making aligned graphs is still a bit of an Art. \ AlignedGraphicsPlots will work well with only a few graphs, and if the graphs \ have similar FrameLabels and PlotLabels. Otherwise it may take a little \ fiddling. The examples illustrate various cases. AlignedGraphicsPlots works \ only for expressions which are displayed with Plot. AlignedGraphicsPlots2 has \ a slightly more complicated input form but allows ListPlots and \ MultipleListPlots to also be used.\ \>", "Text"], Cell["\<\ A third routine, VerticalPlots, is presented for handling the case of many \ vertically stacked plots. It dispenses with a GraphicsArray, and simply \ scales and shifts each function to fit into its own horizontal segment of a \ single plot. Instead of regular tick marks, the range of each plot is shown \ on the left. If you want to see many plots at once, you really don't have \ room for many tick marks anyway. VerticalPlots is faster and easier to use \ than AlignedGraphicsPlots, and alignment is automatic.\ \>", "Text"], Cell["\<\ Finally, I show how my DrawingPaper routine can be used to craft more \ complicated aligned graphics. With it, contour and density graphics can also \ be used. It does require craft, but you can produce nice graphics with it. \ The technique is illustrated with an example.\ \>", "Text"], Cell[TextData[{ "There are other possible solutions to comparing a number of functions. One \ is the Graphics`Graphics3D` routine StackedGraphics.Another solution is the \ package MongoArray available at\n", ButtonBox["http://www.mathsource.com/Content/Enhancements/Graphics/2D/0208-\ 538", ButtonData:>{ URL[ "http://www.mathsource.com/Content/Enhancements/Graphics/2D/0208-538"], None}, ButtonStyle->"Hyperlink"], ". The MongoArray package works in my Version 3, but does not work in my \ Version 4.." }], "Text"], Cell["\<\ These routines were done in Version 4. I believe the only inconsistency with \ Version 3 is in the use of AbsoluteOptions in some of the routines. If you \ are working in Version 3, change these to FullOptions.\ \>", "Text"], Cell[BoxData[{ \(Needs["\"]\), "\[IndentingNewLine]", \(Needs["\"]\)}], "Input"], Cell["\<\ This makes certain we are all using the same TextStyle, but you don't have to \ use this TextStyle, and TextStyle can also be supplied to individual graphs \ with the routines.\ \>", "Text"], Cell[CellGroupData[{ Cell[BoxData[ \($TextStyle = {FontFamily \[Rule] "\", FontSize \[Rule] 12, FontWeight \[Rule] "\"}\)], "Input"], Cell[BoxData[ \({FontFamily \[Rule] "Courier", FontSize \[Rule] 12, FontWeight \[Rule] "Bold"}\)], "Output"] }, Open ]], Cell[CellGroupData[{ Cell["Small AspectRatios", "Section"], Cell["A small AspectRatio is a real problem.", "Text"], Cell[BoxData[ \(\(Plot[Sin[x], {x, 0, 100}, Frame \[Rule] True, FrameLabel \[Rule] {x, y}, PlotLabel \[Rule] Sin[x], AspectRatio \[Rule] 0.2, Background \[Rule] Linen];\)\)], "Input"], Cell[TextData[{ "I consider this to be a flaw in ", StyleBox["Mathematica", FontSlant->"Italic"], " graphics. ", StyleBox["Mathematica", FontSlant->"Italic"], " should have picked a better ImageSize. In single plots it can be remedied \ by specifying an ImageSize which better accommodates the overall plot ratio." }], "Text"], Cell[BoxData[ \(\(Plot[Sin[x], {x, 0, 100}, Frame \[Rule] True, FrameLabel \[Rule] {x, y}, PlotLabel \[Rule] Sin[x], AspectRatio \[Rule] 0.2, ImageSize \[Rule] {500, 143}, Background \[Rule] Linen];\)\)], "Input"], Cell["\<\ Notice that the frame has an aspect ratio of 0.2. But the overall display \ must be given an \"aspect ratio\" which accommodates the space taken up by \ the labels. Is there a way to calculate this in advance? We would like to be \ able to handle small aspect ratios, because if we are going to stack up a \ number of plots, we need a small aspect ratio if we want to see them all at \ once. Otherwise, what's the purpose of making a graphics array? But, \ unfortunately, we can't combine ImageSize and the individual plots in \ GraphicsArray. We can, however, give an ImageSize for an overall \ GraphicsArray, and attempt to make it conform to the combination of plots.\ \>", "Text"] }, Closed]], Cell[CellGroupData[{ Cell["The AlignedGraphicsPlots Routine - Evaluate", "Section"], Cell["This is the AlignedGraphicsPlots routine.", "Text"], Cell[BoxData[{ \(\(AlignedGraphicsPlots::usage = "\";\)\[IndentingNewLine]\), "\ \[IndentingNewLine]", \(\(Options[AlignedGraphicsPlots] = {AGPCommonOptions \[Rule] {}, AGPArrayOptions \[Rule] {}, AGPSpacer \[Rule] 6, AGPShowOptions \[Rule] {}, AGPTickRules \[Rule] {}};\)\[IndentingNewLine]\), "\ \[IndentingNewLine]", \(AlignedGraphicsPlots[plots_List, xiterator_List, opts___] := \[IndentingNewLine]Module[{nplots = Length[plots], \ plotList\ = \ \(Flatten[List[#], \ 1]\ &\)\ /@ \ plots, plot, fticks, spacer, spacertick, spacepos, i, comopts, arrayopts, showopts, tickrules}, \[IndentingNewLine]comopts = \(AGPCommonOptions /. \ {opts}\) /. Options[ AlignedGraphicsPlots]; \[IndentingNewLine]arrayopts = \ \(AGPArrayOptions /. {opts}\) /. Options[AlignedGraphicsPlots]; \[IndentingNewLine]showopts = \ \(AGPShowOptions /. {opts}\) /. Options[AlignedGraphicsPlots]; \[IndentingNewLine]spacer = \ \(AGPSpacer /. {opts}\) /. Options[AlignedGraphicsPlots]; \[IndentingNewLine]tickrules = \ \(AGPTickRules /. {opts}\) /. Options[AlignedGraphicsPlots]; \[IndentingNewLine]spacertick = StyleForm[StringJoin[Table["\<0\>", {spacer}]], ShowContents \[Rule] False]; \[IndentingNewLine]Do[ plot[i] = Plot[Evaluate[ plotList\[LeftDoubleBracket]i, 1\[RightDoubleBracket]], xiterator, Frame \[Rule] True, \[IndentingNewLine]DisplayFunction \[Rule] Identity, Evaluate[ Sequence @@ Drop[plotList\[LeftDoubleBracket]i\[RightDoubleBracket], 1]], Evaluate[Sequence @@ comopts]], {i, 1, nplots}]; \[IndentingNewLine]Do[ fticks[i] = \(AbsoluteOptions[plot[i], FrameTicks]\)\[LeftDoubleBracket]1, 2\[RightDoubleBracket] /. \ tickrules, {i, 1, nplots}]; \[IndentingNewLine]Do[ spacepos = \(fticks[i]\)\[LeftDoubleBracket]2, 1, 1\[RightDoubleBracket]; fticks[i] = ReplacePart[ fticks[i], \ \(fticks[ i]\)\[LeftDoubleBracket]2\[RightDoubleBracket]~ Join~{{spacepos, spacertick, {0, 0}}}, \ 2], {i, 1, nplots}]; \[IndentingNewLine]Show[ GraphicsArray[ Table[{Show[plot[i], FrameTicks \[Rule] fticks[i]]}, {i, 1, nplots}], Sequence @@ arrayopts], DisplayFunction \[Rule] $DisplayFunction, Evaluate[Sequence @@ showopts]]\[IndentingNewLine]]\)}], "Input"] }, Closed]], Cell[CellGroupData[{ Cell["Using AlignedGraphicsPlots", "Section"], Cell[CellGroupData[{ Cell["First Examples", "Subsection"], Cell[TextData[{ "In the simplest usage we can just give a ", StyleBox["list of functions", FontColor->RGBColor[1, 0, 0]], " to plot and the ", StyleBox["domain iterator", FontColor->RGBColor[0, 0, 1]], ". Color is just used here for instructional purposes. You do not need to \ use the color in your statements." }], "Text"], Cell[BoxData[ RowBox[{ RowBox[{"AlignedGraphicsPlots", "[", RowBox[{ StyleBox[\({x, x\^6}\), FontColor->RGBColor[1, 0, 0]], ",", StyleBox[\({x, 0, 10}\), FontColor->RGBColor[0, 0, 1]]}], "]"}], ";"}]], "Input"], Cell["\<\ Enlarge this, if necessary, to obtain a better looking plot. The main \ technique that AlignedGraphicsPlots used to obtain alignment was to insert an \ invisible spacer tick on the y axis of each plot. This was a suggestion of \ Bob Hanlon. The default width of this spacer is six 0's in whichever font is \ being used. Sometimes this may not be enough, or may be too much. You can \ specify the spacing with the option AGPSpacer.\ \>", "Text"], Cell["\<\ You can pass options for the overall plot, options used in the final \ Show[GraphicsArray[]] statement, with the option AGPShowOptions.\ \>", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"AlignedGraphicsPlots", "[", RowBox[{\({x, x\^6}\), ",", \({x, 0, 10}\), ",", StyleBox[\(AGPShowOptions \[Rule] {ImageSize \[Rule] 300, Background \[Rule] LemonChiffon}\), FontColor->RGBColor[1, 0, 0]]}], "]"}], ";"}]], "Input"], Cell["\<\ You can pass common options to each of the graphs using the option \ AGPCommonOptions.\ \>", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"AlignedGraphicsPlots", "[", RowBox[{\({x, x\^6}\), ",", \({x, 0, 10}\), ",", "\[IndentingNewLine]", StyleBox[\(AGPCommonOptions \[Rule] {Background \[Rule] Linen, PlotStyle \[Rule] Blue}\), FontColor->RGBColor[1, 0, 0]], ",", "\[IndentingNewLine]", \(AGPShowOptions \[Rule] {ImageSize \[Rule] 300, Background \[Rule] LemonChiffon}\)}], "]"}], ";"}]], "Input"], Cell["\<\ You can pass options to GraphicsArray using the AGPArrayOptions option. The \ main one is GraphicsSpacing.\ \>", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"AlignedGraphicsPlots", "[", RowBox[{\({x, x\^6}\), ",", \({x, 0, 10}\), ",", "\[IndentingNewLine]", \(AGPCommonOptions \[Rule] {Background \ \[Rule] Linen, PlotStyle \[Rule] Blue}\), ",", "\[IndentingNewLine]", StyleBox[\(AGPArrayOptions \[Rule] {GraphicsSpacing \[Rule] 0}\), FontColor->RGBColor[1, 0, 0]], ",", "\[IndentingNewLine]", \(AGPShowOptions \[Rule] {ImageSize \[Rule] 300, Background \[Rule] LemonChiffon}\)}], "]"}], ";"}]], "Input"], Cell["You can pass options to the individual plots directly.", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"AlignedGraphicsPlots", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"x", ",", StyleBox[\(Background \[Rule] MintCream\), FontColor->RGBColor[1, 0, 0]], StyleBox[",", FontColor->RGBColor[1, 0, 0]], StyleBox[\(PlotStyle \[Rule] Blue\), FontColor->RGBColor[1, 0, 0]]}], "}"}], ",", RowBox[{"{", RowBox[{\(x\^6\), ",", StyleBox[\(Background \[Rule] Linen\), FontColor->RGBColor[1, 0, 0]], StyleBox[",", FontColor->RGBColor[1, 0, 0]], StyleBox[\(PlotStyle \[Rule] SeaGreen\), FontColor->RGBColor[1, 0, 0]]}], "}"}]}], "}"}], ",", \({x, 0, 10}\), ",", "\[IndentingNewLine]", \(AGPArrayOptions \[Rule] {GraphicsSpacing \ \[Rule] 0}\), ",", "\[IndentingNewLine]", \(AGPShowOptions \[Rule] {ImageSize \[Rule] 300, Background \[Rule] LemonChiffon}\)}], "]"}], ";"}]], "Input"], Cell["\<\ You can write text into any of the graphs by using Epilog. The coordinates \ can be clicked off the graphs in the regular manner.\ \>", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"AlignedGraphicsPlots", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ "x", ",", \(Background \[Rule] MintCream\), ",", \(PlotStyle \[Rule] Blue\), ",", StyleBox[\(Epilog \[Rule] Text[x, {4.35694, 5.66576}]\), FontColor->RGBColor[1, 0, 0]]}], "}"}], ",", RowBox[{"{", RowBox[{\(x\^6\), ",", \(Background \[Rule] Linen\), ",", \(PlotStyle \[Rule] SeaGreen\), ",", StyleBox[\(Epilog \[Rule] Text[x\^6, {4.03316, 10808.1}]\), FontColor->RGBColor[1, 0, 0]]}], "}"}]}], "}"}], ",", \({x, 0, 10}\), ",", "\[IndentingNewLine]", \(AGPArrayOptions \[Rule] {GraphicsSpacing \ \[Rule] 0}\), ",", "\[IndentingNewLine]", \(AGPShowOptions \[Rule] {ImageSize \[Rule] 300, Background \[Rule] LemonChiffon}\)}], "]"}], ";"}]], "Input"] }, Closed]], Cell[CellGroupData[{ Cell["The AGPTickRules Option", "Subsection"], Cell[TextData[{ StyleBox["Mathematica", FontSlant->"Italic"], " generally tries to display tick values as integers." }], "Text"], Cell[BoxData[ \(\(g1 = Plot[x\^6, {x, 0, 10}, Frame \[Rule] True];\)\)], "Input"], Cell[TextData[{ "But in extracting those tick marks with AbsoluteOptions, ", StyleBox["Mathematica", FontSlant->"Italic"], " converts to real numbers." }], "Text"], Cell[CellGroupData[{ Cell[BoxData[ \(Short[\(AbsoluteOptions[g1, \ FrameTicks]\)\_\(\(\[LeftDoubleBracket]\)\(1, 2\)\(\[RightDoubleBracket]\)\), 5]\)], "Input"], Cell[BoxData[ TagBox[\({{{0.`, 0.`, {0.00625`, 0.`}, {GrayLevel[0.`], AbsoluteThickness[0.25`]}}, {2.`, 2.`, {0.00625`, 0.`}, {GrayLevel[0.`], AbsoluteThickness[ 0.25`]}}, \[LeftSkeleton]18\[RightSkeleton], {9.5`, \*"\<\"\"\ \>", {0.00375`, 0.`}, {GrayLevel[0.`], AbsoluteThickness[ 0.125`]}}}, {\[LeftSkeleton]1\[RightSkeleton]}, {\ \[LeftSkeleton]1\[RightSkeleton]}, {{\[LeftSkeleton]1\[RightSkeleton]}, \ \[LeftSkeleton]37\[RightSkeleton]}}\), (Short[ #, 5]&)]], "Output"] }, Open ]], Cell["\<\ AlignedGraphicsPlots has to do this to add the spacer tick. Some people do \ not like the tick marks with the periods. You can pass a set of rules for \ massaging the tick mark formatting with AGPTickRules.\ \>", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"AlignedGraphicsPlots", "[", RowBox[{\({x, x\^6}\), ",", \({x, 0, 10}\), ",", "\[IndentingNewLine]", \(AGPCommonOptions \[Rule] {Background \ \[Rule] Linen, PlotStyle \[Rule] Blue}\), ",", "\[IndentingNewLine]", \(AGPArrayOptions \[Rule] {GraphicsSpacing \ \[Rule] 0}\), ",", "\[IndentingNewLine]", \(AGPShowOptions \[Rule] {ImageSize \[Rule] 300, Background \[Rule] LemonChiffon}\), ",", "\[IndentingNewLine]", StyleBox[\(AGPTickRules \[Rule] {z_ /; Round[z] \[Equal] z \[RuleDelayed] Round[z]}\), FontColor->RGBColor[1, 0, 0]]}], "]"}], ";"}]], "Input"], Cell["\<\ I did not make this a built-in rule because it may not be desirable in all \ cases. You may in some cases want a fancier rule, especially when some values \ are in exponent notation.\ \>", "Text"] }, Closed]], Cell[CellGroupData[{ Cell["Stacking a Number of Graphs and Using PlotRegion", "Subsection"], Cell[TextData[{ "Here some Art come in. If we want to stack a number of graphs, and still \ see them all at once, we have to lower the AspectRatio of each graph. We try \ to make the overall ImageSize accommodate the combined graphs. The following \ attempt does not quite succeed. Why does ", StyleBox["Mathematica", FontSlant->"Italic"], " fill the regions differently? I don't know. " }], "Text"], Cell[BoxData[ RowBox[{ RowBox[{"AlignedGraphicsPlots", "[", RowBox[{\(Table[BesselJ[n, x], {n, 1, 3}]\), ",", \({x, 0, 10}\), ",", "\[IndentingNewLine]", RowBox[{"AGPCommonOptions", "\[Rule]", RowBox[{"{", RowBox[{ StyleBox[\(AspectRatio \[Rule] 0.3\), FontColor->RGBColor[1, 0, 0]], ",", \(Background \[Rule] MintCream\)}], "}"}]}], ",", "\[IndentingNewLine]", \(AGPArrayOptions \[Rule] {GraphicsSpacing \ \[Rule] 0}\), ",", "\[IndentingNewLine]", RowBox[{"AGPShowOptions", "\[Rule]", RowBox[{"{", RowBox[{ StyleBox[\(ImageSize \[Rule] {400, 350}\), FontColor->RGBColor[1, 0, 0]], ",", \(Background \[Rule] LemonChiffon\)}], "}"}]}], ",", "\[IndentingNewLine]", \(AGPSpacer \[Rule] 4\)}], "]"}], ";"}]], "Input"], Cell["\<\ There is a remedy. If we cut down the PlotRegion of all graphs, to match the \ \"apparent\" PlotRegion of the shortest graph, then the alignment will be \ restored. This seems to be a snap-in effect. If the x plot region is cut down \ enough, the graphs will align. But the more the plot region is cut down, the \ more wasted space there will be at the right and left edges of the graphs. \ Here, the PlotRegion has been passed to all the graphs via the \ AGPCommonOptions option.\ \>", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"AlignedGraphicsPlots", "[", RowBox[{\(Table[BesselJ[n, x], {n, 1, 3}]\), ",", \({x, 0, 10}\), ",", "\[IndentingNewLine]", RowBox[{"AGPCommonOptions", "\[Rule]", RowBox[{"{", RowBox[{\(AspectRatio \[Rule] 0.3\), ",", \(Background \[Rule] MintCream\), ",", StyleBox[\(PlotRegion \[Rule] {{0.07, 0.93}, {0, 1}}\), FontColor->RGBColor[1, 0, 0]]}], "}"}]}], ",", "\[IndentingNewLine]", \(AGPArrayOptions \[Rule] {GraphicsSpacing \ \[Rule] 0}\), ",", "\[IndentingNewLine]", \(AGPShowOptions \[Rule] {ImageSize \[Rule] \ {400, 350}, Background \[Rule] LemonChiffon}\), ",", "\[IndentingNewLine]", \(AGPSpacer \[Rule] 4\)}], "]"}], ";"}]], "Input"], Cell["\<\ It is a bit delicate and you may have to experiment with AspectRatio and \ ImageSize until you obtain something close to what you want, and then try to \ snap it in with PlotRegion.\ \>", "Text"] }, Closed]], Cell[CellGroupData[{ Cell["Adding Labels to Graphs", "Subsection"], Cell["\<\ If you wish to add labels to graphs, it is easiest to add similar labels to \ all of the graphs. Here a blank x Frame label is used on the two top graphs. \ We seem to have achieved alignment with out cutting down the PlotRegion. \ Still there is some wasted space.\ \>", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"AlignedGraphicsPlots", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{\(BesselJ[1, x]\), ",", StyleBox[\(FrameLabel \[Rule] {"\< \>", y}\), FontColor->RGBColor[1, 0, 0]], StyleBox[",", FontColor->RGBColor[1, 0, 0]], StyleBox[\(PlotLabel \[Rule] BesselJ[1, x]\), FontColor->RGBColor[1, 0, 0]]}], "}"}], ",", RowBox[{"{", RowBox[{\(BesselJ[2, x]\), ",", StyleBox[\(FrameLabel \[Rule] {"\< \>", y}\), FontColor->RGBColor[1, 0, 0]], StyleBox[",", FontColor->RGBColor[1, 0, 0]], StyleBox[\(PlotLabel \[Rule] BesselJ[2, x]\), FontColor->RGBColor[1, 0, 0]]}], "}"}], ",", RowBox[{"{", RowBox[{\(BesselJ[3, x]\), ",", StyleBox[\(FrameLabel \[Rule] {x, y}\), FontColor->RGBColor[1, 0, 0]], StyleBox[",", FontColor->RGBColor[1, 0, 0]], StyleBox[\(PlotLabel \[Rule] BesselJ[3, x]\), FontColor->RGBColor[1, 0, 0]]}], "}"}]}], "}"}], ",", \({x, 0, 10}\), ",", "\[IndentingNewLine]", \(AGPCommonOptions \[Rule] {AspectRatio \ \[Rule] 0.35, Background \[Rule] MintCream, PlotRegion \[Rule] {{0, 1}, {0, 1}}}\), ",", "\[IndentingNewLine]", \(AGPArrayOptions \[Rule] {GraphicsSpacing \ \[Rule] 0}\), ",", "\[IndentingNewLine]", \(AGPShowOptions \[Rule] {ImageSize \[Rule] \ {500, 550}, Background \[Rule] LemonChiffon}\), ",", "\[IndentingNewLine]", \(AGPSpacer \[Rule] 4\)}], "]"}], ";"}]], "Input"], Cell["\<\ If the blank x Label is replace with None in the two top graphs, things \ become more difficult.\ \>", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"AlignedGraphicsPlots", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{\(BesselJ[1, x]\), ",", RowBox[{"FrameLabel", "\[Rule]", RowBox[{"{", RowBox[{ StyleBox["None", FontColor->RGBColor[1, 0, 0]], ",", "y"}], "}"}]}], ",", \(PlotLabel \[Rule] BesselJ[1, x]\)}], "}"}], ",", RowBox[{"{", RowBox[{\(BesselJ[2, x]\), ",", RowBox[{"FrameLabel", "\[Rule]", RowBox[{"{", RowBox[{ StyleBox["None", FontColor->RGBColor[1, 0, 0]], ",", "y"}], "}"}]}], ",", \(PlotLabel \[Rule] BesselJ[2, x]\)}], "}"}], ",", \({BesselJ[3, x], FrameLabel \[Rule] {x, y}, PlotLabel \[Rule] BesselJ[3, x]}\)}], "}"}], ",", \({x, 0, 10}\), ",", "\[IndentingNewLine]", \(AGPCommonOptions \[Rule] {AspectRatio \ \[Rule] 0.35, Background \[Rule] MintCream, PlotRegion \[Rule] {{0, 1}, {0, 1}}}\), ",", "\[IndentingNewLine]", \(AGPArrayOptions \[Rule] {GraphicsSpacing \ \[Rule] 0}\), ",", "\[IndentingNewLine]", \(AGPShowOptions \[Rule] {ImageSize \[Rule] \ {500, 550}, Background \[Rule] LemonChiffon}\), ",", "\[IndentingNewLine]", \(AGPSpacer \[Rule] 4\)}], "]"}], ";"}]], "Input"], Cell["\<\ Again, the alignment can be snapped in by cutting down the PlotRegion. But \ the more unbalanced the labeling is, the more wasted space there will be in \ obtaining alignment. \ \>", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"AlignedGraphicsPlots", "[", RowBox[{\({{BesselJ[1, x], FrameLabel \[Rule] {None, y}, PlotLabel \[Rule] BesselJ[1, x]}, {BesselJ[2, x], FrameLabel \[Rule] {None, y}, PlotLabel \[Rule] BesselJ[2, x]}, {BesselJ[3, x], FrameLabel \[Rule] {x, y}, PlotLabel \[Rule] BesselJ[3, x]}}\), ",", \({x, 0, 10}\), ",", "\[IndentingNewLine]", RowBox[{"AGPCommonOptions", "\[Rule]", RowBox[{"{", RowBox[{\(AspectRatio \[Rule] 0.35\), ",", \(Background \[Rule] MintCream\), ",", RowBox[{"PlotRegion", "\[Rule]", RowBox[{"{", RowBox[{ StyleBox[\({0.1, 0.9}\), FontColor->RGBColor[1, 0, 0]], ",", \({0, 1}\)}], "}"}]}]}], "}"}]}], ",", "\[IndentingNewLine]", \(AGPArrayOptions \[Rule] {GraphicsSpacing \ \[Rule] 0}\), ",", "\[IndentingNewLine]", \(AGPShowOptions \[Rule] {ImageSize \[Rule] \ {500, 550}, Background \[Rule] LemonChiffon}\), ",", "\[IndentingNewLine]", \(AGPSpacer \[Rule] 4\)}], "]"}], ";"}]], "Input"], Cell["\<\ I believe that these are the main considerations in obtaining alignment. If \ anyone else has good ideas, I would be glad to hear from them.\ \>", "Text"] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell["The AlignedGraphicsPlots2 Routine - Evaluate", "Section"], Cell["This is the AlignedGraphicsPlots2 routine.", "Text"], Cell[BoxData[{ \(\(ClearAll[AlignedGraphicsPlots2];\)\), "\[IndentingNewLine]", \(\(AlignedGraphicsPlots2::usage = "\";\)\[IndentingNewLine]\), "\[IndentingNewLine]", \(\(Options[AlignedGraphicsPlots2] = {AGCommonOptions \[Rule] {}, AGArrayOptions \[Rule] {}, AGSpacer \[Rule] 6, AGShowOptions \[Rule] {}, AGTickRules \[Rule] {}};\)\[IndentingNewLine]\), "\ \[IndentingNewLine]", \(AlignedGraphicsPlots2[plots_List, opts___] := \[IndentingNewLine]Module[{nplots = Length[plots], args, plottype, \ plot, fticks, spacer, spacertick, spacepos, i, comopts, arrayopts, showopts, tickrules}, \[IndentingNewLine]\[IndentingNewLine]comopts = \ \(AGCommonOptions /. {opts}\) /. Options[AlignedGraphicsPlots2]; \[IndentingNewLine]arrayopts = \ \(AGArrayOptions /. {opts}\) /. Options[AlignedGraphicsPlots2]; \[IndentingNewLine]showopts = \ \(AGShowOptions /. {opts}\) /. Options[AlignedGraphicsPlots2]; \[IndentingNewLine]spacer = \ \(AGSpacer /. {opts}\) /. Options[AlignedGraphicsPlots2]; \[IndentingNewLine]tickrules = \ \(AGTickRules /. {opts}\) /. Options[AlignedGraphicsPlots2]; \[IndentingNewLine]spacertick = StyleForm[StringJoin[Table["\<0\>", {spacer}]], ShowContents \[Rule] False]; \[IndentingNewLine]\[IndentingNewLine]Block[{$\ DisplayFunction = Identity}, \[IndentingNewLine]Do[ args = Join[ plots\[LeftDoubleBracket]i, 2\[RightDoubleBracket], {Evaluate[ Sequence @@ comopts]}, {Frame \[Rule] True}]; plottype = plots\[LeftDoubleBracket]i, 1\[RightDoubleBracket]; plot[i] = plottype @@ args, {i, 1, nplots}]]; \[IndentingNewLine]\[IndentingNewLine]Do[ fticks[i] = \(AbsoluteOptions[plot[i], FrameTicks]\)\[LeftDoubleBracket]1, 2\[RightDoubleBracket] /. \ tickrules, {i, 1, nplots}]; \[IndentingNewLine]\[IndentingNewLine]Do[ spacepos = \(fticks[i]\)\[LeftDoubleBracket]2, 1, 1\[RightDoubleBracket]; fticks[i] = ReplacePart[ fticks[i], \ \(fticks[ i]\)\[LeftDoubleBracket]2\[RightDoubleBracket]~ Join~{{spacepos, spacertick, {0, 0}}}, \ 2], {i, 1, nplots}]; \[IndentingNewLine]\[IndentingNewLine]Show[ GraphicsArray[ Table[{Show[plot[i], FrameTicks \[Rule] fticks[i], DisplayFunction \[Rule] Identity]}, {i, 1, nplots}], Sequence @@ arrayopts], DisplayFunction \[Rule] $DisplayFunction, Evaluate[Sequence @@ showopts]]\[IndentingNewLine]]\)}], "Input"] }, Closed]], Cell[CellGroupData[{ Cell["Using AlignedGraphicsPlots2", "Section"], Cell["\<\ AlignedGraphicsPlots2 allows combinations of Plot, ListPlot and \ MultipleListPlot to be used. This requires a more general form of input.\ \>", "Text"], Cell["\<\ Here we duplicate an earlier example. It is just like writing ordinary Plot \ statements, except that the arguments are in curly brackets and separated \ from the Head. Notice that the domain iterator is now given separately for \ each plot. \ \>", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"AlignedGraphicsPlots2", "[", RowBox[{ RowBox[{"{", "\[IndentingNewLine]", RowBox[{ StyleBox[\({Plot, {x, {x, 0, 10}, Background \[Rule] Linen, PlotStyle \[Rule] SeaGreen}}\), FontColor->RGBColor[1, 0, 0]], ",", "\[IndentingNewLine]", StyleBox[\({Plot, {x\^6, {x, 0, 10}, Background \[Rule] MintCream, PlotStyle \[Rule] Blue}}\), FontColor->RGBColor[1, 0, 0]]}], "}"}], ",", "\[IndentingNewLine]", \(AGArrayOptions \[Rule] {GraphicsSpacing \ \[Rule] 0}\), ",", "\[IndentingNewLine]", \(AGShowOptions \[Rule] {Background \[Rule] LemonChiffon, ImageSize \[Rule] 350}\)}], "]"}], ";"}]], "Input"], Cell["\<\ It is possible to plot one of the functions over a lesser domain, provided we \ assure that the same x plot range is used in both plots. We can still insert \ AGCommonOptions into individual plots.\ \>", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"AlignedGraphicsPlots2", "[", RowBox[{ RowBox[{"{", "\[IndentingNewLine]", RowBox[{\({Plot, {x, {x, 0, 10}, Background \[Rule] Linen, PlotStyle \[Rule] SeaGreen}}\), ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{"Plot", ",", RowBox[{"{", RowBox[{\(x\^6\), ",", StyleBox[\({x, 2, 8}\), FontColor->RGBColor[1, 0, 0]], ",", \(Background \[Rule] MintCream\), ",", \(PlotStyle \[Rule] Blue\)}], "}"}]}], "}"}]}], "}"}], ",", "\[IndentingNewLine]", StyleBox[\(AGCommonOptions \[Rule] {PlotRange \[Rule] {{\(-0.25\), 10.25}, All}}\), FontColor->RGBColor[1, 0, 0]], ",", "\[IndentingNewLine]", \(AGArrayOptions \[Rule] {GraphicsSpacing \ \[Rule] 0}\), ",", "\[IndentingNewLine]", \(AGShowOptions \[Rule] {Background \[Rule] LemonChiffon, ImageSize \[Rule] 350}\), ",", "\[IndentingNewLine]", StyleBox[\(AGSpacer \[Rule] 7\), FontColor->RGBColor[1, 0, 0]]}], "]"}], ";"}]], "Input"], Cell["\<\ Here is a case of using a ListPlot, along with a smaller AspectRatio.\ \>", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"AlignedGraphicsPlots2", "[", RowBox[{ RowBox[{"{", "\[IndentingNewLine]", RowBox[{\({Plot, {x, {x, 0, 10}, Background \[Rule] Linen, PlotStyle \[Rule] SeaGreen, PlotLabel \[Rule] "\
"}}\), ",", "\[IndentingNewLine]", StyleBox[\({ListPlot, {Table[{x, x\^6}, {x, 0, 10}], Prolog \[Rule] AbsolutePointSize[5], Background \[Rule] MintCream, PlotStyle \[Rule] Blue, PlotLabel \[Rule] "\
"}}\), FontColor->RGBColor[1, 0, 0]]}], "}"}], ",", "\[IndentingNewLine]", \(AGArrayOptions \[Rule] {GraphicsSpacing \ \[Rule] 0}\), ",", "\[IndentingNewLine]", \(AGCommonOptions \[Rule] {AspectRatio \ \[Rule] 0.3}\), ",", "\[IndentingNewLine]", \(AGShowOptions \[Rule] {Background \[Rule] LemonChiffon, ImageSize \[Rule] 500}\), ",", "\[IndentingNewLine]", \(AGSpacer \[Rule] 7\)}], "]"}], ";"}]], "Input"], Cell["\<\ If the x values of the data points in the list plot do not span the same \ domain as the regular plot, we must force a common plot range on all the \ plots.\ \>", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"AlignedGraphicsPlots2", "[", RowBox[{ RowBox[{"{", "\[IndentingNewLine]", RowBox[{\({Plot, {x, {x, 0, 10}, Background \[Rule] Linen, PlotStyle \[Rule] SeaGreen, PlotLabel \[Rule] "\
"}}\), ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{"ListPlot", ",", RowBox[{"{", RowBox[{ RowBox[{"Table", "[", RowBox[{\({x, x\^6}\), ",", StyleBox[\({x, 1, 9}\), FontColor->RGBColor[1, 0, 0]]}], "]"}], ",", \(Prolog \[Rule] AbsolutePointSize[5]\), ",", \(Background \[Rule] MintCream\), ",", \(PlotStyle \[Rule] Blue\), ",", \(PlotLabel \[Rule] "\
"\)}], "}"}]}], "}"}]}], "}"}], ",", "\[IndentingNewLine]", \(AGArrayOptions \[Rule] {GraphicsSpacing \ \[Rule] 0}\), ",", "\[IndentingNewLine]", RowBox[{"AGCommonOptions", "\[Rule]", RowBox[{"{", RowBox[{\(AspectRatio \[Rule] 0.3\), ",", StyleBox[\(PlotRange \[Rule] {{\(-0.25\), 10.25}, All}\), FontColor->RGBColor[1, 0, 0]]}], "}"}]}], ",", "\[IndentingNewLine]", \(AGShowOptions \[Rule] {Background \[Rule] LemonChiffon, ImageSize \[Rule] 500}\), ",", "\[IndentingNewLine]", \(AGSpacer \[Rule] 7\)}], "]"}], ";"}]], "Input"], Cell["MultipleListPlots can also be included.", "Text"], Cell[BoxData[ \(Needs["\"]\)], "Input"], Cell[BoxData[{ \(\(list1 = Table[{x, Sin[x]}, {x, 0, 2 \[Pi], 2 \[Pi]/20}];\)\), "\[IndentingNewLine]", \(\(list2 = Table[{x, Cos[x]}, {x, 0, 2 \[Pi], 2 \[Pi]/20}];\)\)}], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"AlignedGraphicsPlots2", "[", RowBox[{ RowBox[{"{", "\[IndentingNewLine]", RowBox[{\({Plot, {10000 {Sin[x], Cos[x]}, {x, 0, 2 \[Pi]}, Background \[Rule] Linen, PlotStyle \[Rule] {Red, SeaGreen}, PlotLabel \[Rule] "\
"}}\), ",", "\[IndentingNewLine]", StyleBox[\({MultipleListPlot, {list1, list2, Prolog \[Rule] AbsolutePointSize[5], Background \[Rule] MintCream, PlotStyle \[Rule] {Red, SeaGreen}, PlotLabel \[Rule] "\
", PlotJoined \[Rule] True, SymbolShape \[Rule] {PlotSymbol[Triangle, 5], PlotSymbol[Star, 5]}}}\), FontColor->RGBColor[1, 0, 0]]}], "}"}], ",", "\[IndentingNewLine]", \(AGArrayOptions \[Rule] {GraphicsSpacing \ \[Rule] 0}\), ",", "\[IndentingNewLine]", \(AGCommonOptions \[Rule] {AspectRatio \ \[Rule] 0.3}\), ",", "\[IndentingNewLine]", \(AGShowOptions \[Rule] {Background \[Rule] LemonChiffon, ImageSize \[Rule] 500}\), ",", "\[IndentingNewLine]", \(AGSpacer \[Rule] 7\)}], "]"}], ";"}]], "Input"] }, Closed]], Cell[CellGroupData[{ Cell["VerticalPlots Routine - Evaluate", "Section"], Cell["\<\ This uses a different approach. We do away with GraphicsArray and just slice \ up a single plot into horizontal stripes where we plot each function. \ Alignment is automatic, since there is nothing to align. The main drawback is \ that our y axis labels are quite abbreviated (but if you are going to stack \ up a number of graphs, you don't have much room for ticks anyway) and you \ have to use Epilog to put on any function labels by hand.\ \>", "Text"], Cell[BoxData[{ \(\(VerticalPlots::usage = "\";\)\[IndentingNewLine]\), "\[IndentingNewLine]", \(\(Options[ VerticalPlots] = {VPTickDisplacement \[Rule] 0.1};\)\[IndentingNewLine]\), "\[IndentingNewLine]", \(VerticalPlots[plotlist_List, xiterator_List, opts___?OptionQ] := \[IndentingNewLine]Module[{plots = Reverse[plotlist], nplots = Length[plotlist], plot, i, g, rmin, rmax, tmin, tmax, t1, t2, temp, cf, xvar, yticks, style, tdisp}, \[IndentingNewLine]tdisp = \(VPTickDisplacement /. {opts}\) \ /. Options[VerticalPlots]; \[IndentingNewLine]Off[ Plot::plnr]; \[IndentingNewLine]xvar = xiterator\[LeftDoubleBracket]1\[RightDoubleBracket]; \ \[IndentingNewLine]Do[plot = plots\[LeftDoubleBracket]i\[RightDoubleBracket]; f[i] = plot\[LeftDoubleBracket]1\[RightDoubleBracket]; rmin[i] = plot\[LeftDoubleBracket]2, 1\[RightDoubleBracket]; rmax[i] = plot\[LeftDoubleBracket]2, 2\[RightDoubleBracket]; \[IndentingNewLine]If[ rmin[i] === Automatic \[Or] rmax[i] === Automatic \[Or] rmin[i] === VPRange \[Or] rmax[i] === VPRange, \[IndentingNewLine]g = Plot[f[i], xiterator, DisplayFunction \[Rule] Identity, Frame \[Rule] True]; \[IndentingNewLine]t1 = \(AbsoluteOptions[g, FrameTicks]\)\[LeftDoubleBracket]1, 2, 2\[RightDoubleBracket]; \[IndentingNewLine]t2 = \ \(AbsoluteOptions[g, PlotRange]\)\[LeftDoubleBracket]1, 2, 2\[RightDoubleBracket]; \[IndentingNewLine]{tmin, tmax} = \({First[#], Last[#]} &\)[ Sort[t1 /. {x_?NumberQ, _, ___} \[Rule] x]]; \[IndentingNewLine]rmin[i] = Which[rmin[i] === Automatic, tmin, rmin[i] === VPRange, t2\[LeftDoubleBracket]1\[RightDoubleBracket], True, rmin[i]]; \[IndentingNewLine]rmax[i] = Which[rmax[i] === Automatic, tmax, rmax[i] === VPRange, t2\[LeftDoubleBracket]2\[RightDoubleBracket], True, rmax[i]]]; \[IndentingNewLine]style[i] = If[Length[plot] \[Equal] 3, plot\[LeftDoubleBracket]3\[RightDoubleBracket], {GrayLevel[ 0]}], {i, 1, nplots}]; \[IndentingNewLine]Do[ temp = \(f[i] - rmin[i]\)\/\(rmax[i] - rmin[i]\); \(cf[i]\)[xvar] = Which[Evaluate[temp < \(-0.02\)], I, \ Evaluate[temp > 1.02], I, \ True, Evaluate[temp]\ ], {i, 1, nplots}]; \[IndentingNewLine]t1 = Join[Table[i, {i, 1, nplots - 1}], Table[\((i - 1)\) + \(cf[i]\)[xvar], {i, 1, nplots}]]; \[IndentingNewLine]Do[ yticks[i] = {{i - 1 + tdisp, rmin[i], 0}, {i - tdisp, rmax[i], 0}}, {i, 1, nplots}]; \[IndentingNewLine]t2 = Flatten[Join[Table[yticks[i], {i, 1, nplots}]], 1]; \[IndentingNewLine]Plot[Evaluate[t1], xiterator, Frame \[Rule] True, FrameLabel \[Rule] {xvar, None}, FrameTicks \[Rule] {Automatic, t2, Automatic, None}, PlotStyle \[Rule] Join[Table[{GrayLevel[0.7], AbsoluteThickness[2]}, Evaluate[{nplots - 1}]], Table[style[i], {i, 1, nplots}]], PlotRange \[Rule] {\(-tdisp\), nplots + tdisp}, Evaluate[FilterOptions[Plot, \ opts]]]; \[IndentingNewLine]On[ Plot::plnr]\[IndentingNewLine]]\)}], "Input"] }, Closed]], Cell[CellGroupData[{ Cell["Using VerticalPlots", "Section"], Cell[TextData[{ "You list the ", StyleBox["expressions to plot", FontColor->RGBColor[1, 0, 0]], ", their minimum and maximum values, and any graphics directives you want \ to use with the plot. These are followed by the ", StyleBox["domain iterator", FontColor->RGBColor[0, 0, 1]], ". General plot options can be included at the end." }], "Text"], Cell[BoxData[ RowBox[{ RowBox[{"VerticalPlots", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{"{", StyleBox[\({x, {0, 10}, Black}, \[IndentingNewLine]{x\^4, {0, 5000}, Blue}, \[IndentingNewLine]{Sin[x], {\(-1\), 1}, {Red, Dashing[{0.02, 0.01\ }]}}, \[IndentingNewLine]{E\^x, {0, 10\^4}, SeaGreen}\), FontColor->RGBColor[1, 0, 0]], "}"}], ",", StyleBox[\({x, 0, 10}\), FontColor->RGBColor[0, 0, 1]], ",", \(Background \[Rule] Linen\), ",", \(PlotLabel \[Rule] "\"\), ",", \(ImageSize \[Rule] 500\), ",", \(TextStyle \[Rule] {FontFamily \[Rule] "\", FontWeight \[Rule] "\"}\), ",", \(Epilog \[Rule] {Text[Sin[x], {3.615, 1.65246}], Text[x\^4, {5.88878, 2.50533}], Text[x, {4.54518, 3.72611}], Text[E\^x, {7.93001, 0.565473}]}\), ",", \(PlotRegion \[Rule] {{0, 0.95}, {0, 1}}\)}], "]"}], ";"}]], "Input"], Cell[TextData[{ "The following plots a list of LegendreP functions. The ymin and ymax \ values have been specified as Automatic. This causes the plot range to be \ taken from the maximum and minimum ticks on a ", StyleBox["Mathematica", FontSlant->"Italic"], " generated plot. This will give nice range numbers, but may very \ occasionally clip a function because sometimes a graph extends slightly \ beyond the minimum or maximum ticks (all ticks, not just labeled ticks). The \ routine tries to compensate for this slightly. Also notice that the y labels \ are set inward for each graph, otherwise they would lie on top of one \ another." }], "Text"], Cell[BoxData[ RowBox[{ RowBox[{"VerticalPlots", "[", RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{\(LegendreP[5, m, z]\), ",", RowBox[{"{", StyleBox[\(Automatic, Automatic\), FontColor->RGBColor[1, 0, 0]], "}"}], ",", "Blue"}], "}"}], ",", \({m, 1, 5}\)}], "]"}], ",", \({z, \(-1\), 1}\), ",", \(AspectRatio \[Rule] 1\), ",", \(Background \[Rule] Linen\), ",", \(Axes \[Rule] None\), ",", \(PlotLabel \[Rule] SequenceForm[LegendreP[5, m, z], "\< \>", 1 \[LessEqual] m \[LessEqual] 5]\), ",", \(PlotRegion \[Rule] {{0, 0.95}, {0, 1}}\), ",", \(ImageSize \[Rule] {450, 450}\)}], "]"}], ";"}]], "Input"], Cell["\<\ With a higher plot, we may want a smaller tick displacement. The option \ VPTicksDisplacement can be used to specify the inward displacement as a \ fraction of each graph width. The default value is 0.1\ \>", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"VerticalPlots", "[", RowBox[{\(Table[{LegendreP[5, m, z], {Automatic, Automatic}, Blue}, {m, 1, 5}]\), ",", \({z, \(-1\), 1}\), ",", StyleBox[\(AspectRatio \[Rule] 2\), FontColor->RGBColor[1, 0, 0]], ",", \(Background \[Rule] Linen\), ",", \(Axes \[Rule] None\), ",", \(PlotLabel \[Rule] SequenceForm[LegendreP[5, m, z], "\< \>", 1 \[LessEqual] m \[LessEqual] 5]\), ",", \(PlotRegion \[Rule] {{0, 0.95}, {0, 1}}\), ",", StyleBox[\(ImageSize \[Rule] {450, 900}\), FontColor->RGBColor[1, 0, 0]], ",", StyleBox[\(VPTickDisplacement \[Rule] 0.05\), FontColor->RGBColor[1, 0, 0]]}], "]"}], ";"}]], "Input"], Cell[TextData[{ "In the following example, ymin and ymax have been set to VPRange. The \ range values are then taken from the PlotRange of a ", StyleBox["Mathematica", FontSlant->"Italic"], " generated plot. They will no longer be nice round numbers but will give \ more precise information about the plot range, and no function will ever be \ clipped." }], "Text"], Cell[BoxData[ RowBox[{ RowBox[{"VerticalPlots", "[", RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{\(LegendreP[5, m, z]\), ",", RowBox[{"{", StyleBox[\(VPRange, VPRange\), FontColor->RGBColor[1, 0, 0]], "}"}], ",", "Blue"}], "}"}], ",", \({m, 1, 5}\)}], "]"}], ",", \({z, \(-1\), 1}\), ",", \(AspectRatio \[Rule] 1\), ",", \(Background \[Rule] Linen\), ",", \(Axes \[Rule] None\), ",", \(PlotLabel \[Rule] SequenceForm[LegendreP[5, m, z], "\< \>", 1 \[LessEqual] m \[LessEqual] 5]\), ",", \(PlotRegion \[Rule] {{0, 0.95}, {0, 1}}\), ",", \(ImageSize \[Rule] {450, 450}\)}], "]"}], ";"}]], "Input"], Cell["\<\ It is possible to use mixtures of numbers, Automatic and VPRange for the plot \ ranges, even within one function.\ \>", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"VerticalPlots", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"x", ",", RowBox[{"{", StyleBox[\(0, 10\), FontColor->RGBColor[1, 0, 0]], "}"}], ",", "Black"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{\(x\^4\), ",", RowBox[{"{", StyleBox[\(0, Automatic\), FontColor->RGBColor[1, 0, 0]], "}"}], ",", "Blue"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{\(Sin[x]\), ",", RowBox[{"{", StyleBox[\(Automatic, Automatic\), FontColor->RGBColor[1, 0, 0]], "}"}], ",", \({Red, Dashing[{0.02, 0.01\ }]}\)}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{\(E\^x\), ",", RowBox[{"{", StyleBox[\(Automatic, VPRange\), FontColor->RGBColor[1, 0, 0]], "}"}], ",", "SeaGreen"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{\(If[Sin[x] > 0, 1, 0]\), ",", RowBox[{"{", StyleBox[\(\(-0.5\), 1.5\), FontColor->RGBColor[1, 0, 0]], "}"}]}], "}"}]}], "}"}], ",", \({x, 0, 10}\), ",", \(VPTickDisplacement \[Rule] 0.15\), ",", \(Background \[Rule] Linen\), ",", \(PlotLabel \[Rule] "\"\), ",", \(ImageSize \[Rule] 500\), ",", \(AspectRatio \[Rule] 1/GoldenRatio\), ",", \(TextStyle \[Rule] {FontFamily \[Rule] "\", FontWeight \[Rule] "\"}\), ",", \(Epilog \[Rule] {Text[Sin[x], {3.61276, 2.73786}], Text[x\^4, {5.13344, 3.66579}], Text[x, {4.38251, 4.68091}], Text[E\^x, {8.13715, 1.6567}], Text["\", {1.24932, 0.430097}]}\)}], "]"}], ";"}]], "Input"] }, Closed]], Cell[CellGroupData[{ Cell["Crafting Aligned Graphics by Hand Using DrawingPaper", "Section"], Cell[TextData[{ "This is for the intrepid who really need unconvential but aligned \ graphics. It uses the DrawingPaper package which can be obtained at my web \ site ", ButtonBox["http://home.earthlink.net/~djmp/", ButtonData:>{ URL[ "http://home.earthlink.net/~djmp/"], None}, ButtonStyle->"Hyperlink"], " . DrawingPaper and its tutorial has been updated as of 1 Jan 2000 to \ include the XTickLine and YTickLine routines needed." }], "Text"], Cell[BoxData[ \(Needs["\"]\)], "Input"], Cell[TextData[{ "The following piece of graphics shows a ContourPlot of ", Cell[BoxData[ \(Sin[x] Sin[y]\)]], " and individual plots of the Sin functions running in the x and y \ directions. " }], "Text"], Cell[BoxData[ \(\(cplot = ContourDraw[ Sin[x] Sin[y], {x, \(-2\) \[Pi], 2 \[Pi]}, {y, \(-2\) \[Pi], 2 \[Pi]}, ColorFunction \[Rule] Hue, PlotPoints \[Rule] 31];\)\)], "Input"], Cell[BoxData[{ \(\(d0 = 0.005;\)\), "\[IndentingNewLine]", \(\(Show[ Graphics[\n\t{Rectangle[{0, \ 5}, \ {5, \ 10}, Graphics[cplot, AspectRatio \[Rule] 1]], \[IndentingNewLine]\[IndentingNewLine]XTickLine[{0.112,\ 4.88, 4.9}, {\(-2\) \[Pi], 2 \[Pi]}, {\(-2\) \[Pi], 2 \[Pi], \[Pi]/2}, 4, \[IndentingNewLine]XTextSpecs \[Rule] {{0, 1}, {1, 0}, 0.01, {FontSize \[Rule] 10}}], \[IndentingNewLine]\[IndentingNewLine]YTickLine[{\ 5.14, 9.89, 5.1}, {\(-2\) \[Pi], 2 \[Pi]}, {\(-2\) \[Pi], 2 \[Pi], \[Pi]/2}, 4, \[IndentingNewLine]YLabTickSpecs \[Rule] {0, 0.00625}, \[IndentingNewLine]YUnLabTickSpecs \[Rule] {0, 0.00375}, \[IndentingNewLine]YTextSpecs \[Rule] {{\(-1\), 0}, {1, 0}, \(-0.01\), {FontSize \[Rule] 10}}], \[IndentingNewLine]\[IndentingNewLine]Rectangle[{\ 0, 2.25}, \ {5, 4.25}, Graphics[Draw[Sin[x], {x, \(-2\) \[Pi], 2 \[Pi]}], AspectRatio \[Rule] 2/5, Background \[Rule] MintCream, PlotRegion \[Rule] {{d0, 1 - d0}, {0, 1}}]], \[IndentingNewLine]\[IndentingNewLine]YTickLine[{\ 2.33, 4.20, 5.1}, {\(-1\), 1}, {\(-1\), 1, 1}, 5, \[IndentingNewLine]YLabTickSpecs \[Rule] {0, 0.00625}, \[IndentingNewLine]YUnLabTickSpecs \[Rule] {0, 0.00375}, \[IndentingNewLine]YTextSpecs \[Rule] {{\(-1\), 0}, {1, 0}, \(-0.01\), {FontSize \[Rule] 10}}], \[IndentingNewLine]\[IndentingNewLine]Rectangle[{\ 6, 5}, \ {8, 10}, Graphics[ Draw[Sin[x], {x, \(-2\) \[Pi], 2 \[Pi]}] /. DrawingTransform[\(-#2\) &, #1 &], AspectRatio \[Rule] 5/2, Background \[Rule] MintCream, PlotRegion \[Rule] {{0, 1}, {d0, 1 - d0}}]], \ \[IndentingNewLine]\[IndentingNewLine]XTickLine[{7.94, 6.05, 4.9}, {\(-1\), 1}, {\(-1\), 1, 1}, 5, \[IndentingNewLine]XTextSpecs \[Rule] {{0, 1}, {1, 0}, 0.01, {FontSize \[Rule] 10}}], \[IndentingNewLine]\[IndentingNewLine]Text[ Sin[x], {5.52056, 3.3808}, {\(-1\), 0}], \[IndentingNewLine]Text[ Sin[y], {6.98359, 4.39998}]}], \n\n AspectRatio \[Rule] Automatic, PlotRange \[Rule] {{0, 8}, {2, 10}}, Background \[Rule] Linen, \n{ImageSize \[Rule] 510, TextStyle \[Rule] {FontFamily \[Rule] "\", FontWeight \[Rule] "\"}, PlotLabel \[Rule] SequenceForm["\", Sin[x] Sin[y]], PlotRegion \[Rule] {{0, 1}, {0.0, 1}}}];\)\)}], "Input", GeneratedCell->False], Cell[TextData[{ "The contour plot and the two sine wave plots have been put in rectangles \ within a larger plot. Click on the plot and you will be able to see the \ rectangles. Things are much easier using the ContourDraw and Draw routines to \ obtain the graphics primitives for the plots. These throw away all frames and \ labels and give us a more predictable, but not perfect, range. XTickLine and \ YTickLine have been used to put the scales back on the plots. But things are \ not perfect. ", StyleBox["Mathematica", FontSlant->"Italic"], " insists on putting extra unpredictable space around the graphics within \ each rectangle even though we have specified the aspect ratios to match the \ rectangle sizes. In this case the sine waves had a little extra space, but \ barely noticeable. The d0 parameter was used with PlotRegion to slightly \ shrink then to match the contour plot. DrawingTransform was used to make the \ second sine wave go in the y direction. The physical extent of the tick lines \ was obtained by reading the positions off the graph. (You have to get the \ coordinates outside the rectangles, not inside where each rectangle has its \ own local coordinates.) Read up in the tutorial for the details of specifying \ tick lines. Notice that it is possible to make a tick line run in the \ negative direction as with the ", Cell[BoxData[ \(Sin[y]\)]], " curve. " }], "Text"] }, Closed]] }, Open ]] }, FrontEndVersion->"4.0 for Microsoft Windows", ScreenRectangle->{{0, 1024}, {0, 683}}, WindowSize->{668, 634}, WindowMargins->{{0, Automatic}, {Automatic, 0}} ] (*********************************************************************** Cached data follows. If you edit this Notebook file directly, not using Mathematica, you must remove the line containing CacheID at the top of the file. The cache data will then be recreated when you save this file from within Mathematica. ***********************************************************************) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[1739, 51, 86, 2, 150, "Title"], Cell[1828, 55, 90, 4, 122, "Subtitle"], Cell[1921, 61, 481, 11, 71, "Text"], Cell[2405, 74, 1099, 28, 90, "Text"], Cell[3507, 104, 785, 12, 147, "Text"], Cell[4295, 118, 538, 8, 90, "Text"], Cell[4836, 128, 297, 5, 71, "Text"], Cell[5136, 135, 550, 13, 90, "Text"], Cell[5689, 150, 234, 4, 52, "Text"], Cell[5926, 156, 135, 2, 50, "Input"], Cell[6064, 160, 200, 4, 52, "Text"], Cell[CellGroupData[{ Cell[6289, 168, 141, 2, 30, "Input"], Cell[6433, 172, 119, 2, 29, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[6589, 179, 37, 0, 53, "Section"], Cell[6629, 181, 54, 0, 33, "Text"], Cell[6686, 183, 205, 3, 50, "Input"], Cell[6894, 188, 344, 9, 52, "Text"], Cell[7241, 199, 244, 4, 50, "Input"], Cell[7488, 205, 694, 10, 128, "Text"] }, Closed]], Cell[CellGroupData[{ Cell[8219, 220, 62, 0, 33, "Section"], Cell[8284, 222, 57, 0, 33, "Text"], Cell[8344, 224, 3575, 64, 850, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[11956, 293, 45, 0, 33, "Section"], Cell[CellGroupData[{ Cell[12026, 297, 36, 0, 47, "Subsection"], Cell[12065, 299, 342, 9, 52, "Text"], Cell[12410, 310, 274, 7, 31, "Input"], Cell[12687, 319, 454, 7, 90, "Text"], Cell[13144, 328, 159, 3, 52, "Text"], Cell[13306, 333, 329, 7, 52, "Input"], Cell[13638, 342, 110, 3, 33, "Text"], Cell[13751, 347, 507, 11, 72, "Input"], Cell[14261, 360, 130, 3, 33, "Text"], Cell[14394, 365, 566, 10, 92, "Input"], Cell[14963, 377, 70, 0, 33, "Text"], Cell[15036, 379, 1229, 27, 114, "Input"], Cell[16268, 408, 153, 3, 52, "Text"], Cell[16424, 413, 1094, 23, 155, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[17555, 441, 45, 0, 31, "Subsection"], Cell[17603, 443, 136, 4, 33, "Text"], Cell[17742, 449, 85, 1, 31, "Input"], Cell[17830, 452, 173, 5, 33, "Text"], Cell[CellGroupData[{ Cell[18028, 461, 150, 3, 31, "Input"], Cell[18181, 466, 588, 12, 100, "Output"] }, Open ]], Cell[18784, 481, 231, 4, 52, "Text"], Cell[19018, 487, 721, 14, 112, "Input"], Cell[19742, 503, 206, 4, 52, "Text"] }, Closed]], Cell[CellGroupData[{ Cell[19985, 512, 70, 0, 31, "Subsection"], Cell[20058, 514, 409, 8, 71, "Text"], Cell[20470, 524, 952, 20, 110, "Input"], Cell[21425, 546, 504, 8, 90, "Text"], Cell[21932, 556, 848, 17, 130, "Input"], Cell[22783, 575, 205, 4, 52, "Text"] }, Closed]], Cell[CellGroupData[{ Cell[23025, 584, 45, 0, 31, "Subsection"], Cell[23073, 586, 289, 5, 71, "Text"], Cell[23365, 593, 1890, 39, 210, "Input"], Cell[25258, 634, 120, 3, 33, "Text"], Cell[25381, 639, 1571, 33, 210, "Input"], Cell[26955, 674, 201, 4, 52, "Text"], Cell[27159, 680, 1256, 25, 210, "Input"], Cell[28418, 707, 164, 3, 52, "Text"] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[28631, 716, 63, 0, 33, "Section"], Cell[28697, 718, 58, 0, 33, "Text"], Cell[28758, 720, 3683, 62, 1010, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[32478, 787, 46, 0, 33, "Section"], Cell[32527, 789, 162, 3, 52, "Text"], Cell[32692, 794, 267, 5, 52, "Text"], Cell[32962, 801, 845, 18, 113, "Input"], Cell[33810, 821, 221, 4, 52, "Text"], Cell[34034, 827, 1304, 28, 153, "Input"], Cell[35341, 857, 93, 2, 33, "Text"], Cell[35437, 861, 1126, 23, 194, "Input"], Cell[36566, 886, 180, 4, 52, "Text"], Cell[36749, 892, 1639, 33, 194, "Input"], Cell[38391, 927, 55, 0, 33, "Text"], Cell[38449, 929, 72, 1, 30, "Input"], Cell[38524, 932, 224, 5, 50, "Input"], Cell[38751, 939, 1363, 28, 230, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[40151, 972, 51, 0, 33, "Section"], Cell[40205, 974, 466, 7, 90, "Text"], Cell[40674, 983, 4542, 72, 1049, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[45253, 1060, 38, 0, 33, "Section"], Cell[45294, 1062, 365, 9, 52, "Text"], Cell[45662, 1073, 1107, 22, 217, "Input"], Cell[46772, 1097, 662, 12, 109, "Text"], Cell[47437, 1111, 851, 18, 90, "Input"], Cell[48291, 1131, 226, 4, 52, "Text"], Cell[48520, 1137, 797, 15, 110, "Input"], Cell[49320, 1154, 375, 8, 71, "Text"], Cell[49698, 1164, 847, 18, 90, "Input"], Cell[50548, 1184, 137, 3, 33, "Text"], Cell[50688, 1189, 2232, 47, 256, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[52957, 1241, 71, 0, 33, "Section"], Cell[53031, 1243, 464, 10, 71, "Text"], Cell[53498, 1255, 68, 1, 30, "Input"], Cell[53569, 1258, 216, 6, 52, "Text"], Cell[53788, 1266, 224, 5, 50, "Input"], Cell[54015, 1273, 2957, 53, 730, "Input"], Cell[56975, 1328, 1422, 24, 223, "Text"] }, Closed]] }, Open ]] } ] *) (*********************************************************************** End of Mathematica Notebook file. ***********************************************************************)