BeginPackage["LegendSpec`"]; LegendSpec::"usage"= "LegendSpec is a utility package used for locating the lower left hand \ corners and specifying the size of Legends in graphs generated by any \ standard Mathematica plotting routine. It was written in version 4.2. It \ gives more precise results than the LogLogCorner, etc., functions that are \ built into MultipleLogListPlot (a separate package also available on \ MathSource). The functions \ {LogLogLocate,LinearLogLocate,LogLinearLocate,LinearLocate} are used for the \ corrsponding plots made with MultipleLogListPlot, MultipleListPlot, or any \ other Mathematica plotting routine that can be used with ShowLegend. The \ input format is LogLogLocate[points_,x_,y_,a_:0.612] enables the user to \ locate the legend corner at or very near the physical coordinates specified \ by x and y. The input points are the set {{x1,y1},{x2,y2}} obtained by \ clicking on (and recording the data in Copy) of the lower left and upper \ right corners of the main graphic. The AspectRatio {a} of the plot is \ defaulted to 1/GoldenRatio. The function SizeSpec[text_,entrys_,a_:0.612] \ specifies a reasonable input to the Legend size specification. If the graphic \ is to be displayed at other than the Golden Ratio, the ratio {a} should be \ specified in the input. The text input is in the format -longest line of text in the legend-,enclosed in double quotes. The entrys input is the number of lines of entry of text in the \ legend, including the LegendTitle."; LogLogLocate::"usage"= "LogLogLocate[data__List,x_,y_,a_] locates the Legend in a LogLogPlot"; LinearLogLocate::"usage"= "LinearLogLocate[data__List,x_,y_,a_] locates the Legend in a \ LinearLogPlot (called LogPlot in the standard Mathematica Function)"; LogLinearLocate::"usage"= "LogLinearLocate[data__List,x_,y_,a_] locates the Legend in a \ LogLinearPlot"; LinearLocate::"usage"= "LinearLocate[{data__List},x_,y_,a_] locates the Legend in a LinearPlot"; SizeSpec::"usage"= "SizeSpec[text_,entrys_,a_:0.612] specifies the LegendSize"; Begin["`Private`"]; LogLogLocate[points_,x_,y_,a_:0.612]:=Module[{graphcenter,halflength}, graphcenter:= Table[{(points[[2]][[1]]+points[[1]][[1]])/ 2,(points[[2]][[2]]+points[[1]][[2]])/2}]; halflength:= Table[{(points[[2]][[1]]-points[[1]][[1]])/ 2,(points[[2]][[2]]-points[[1]][[2]])/2}]; If[a\[LessEqual]1, Table[{(Log[10,x]-graphcenter[[1]])/halflength[[1]], a (Log[10,y]-graphcenter[[2]])/halflength[[2]]}], Table[{(Log[10,x]-graphcenter[[1]])/(a halflength[[1]]),(Log[10,y]- graphcenter[[2]])/halflength[[2]]}]]]; LinearLogLocate[points_,x_,y_,a_:0.612]:=Module[{graphcenter,halflength}, graphcenter:= Table[{(points[[2]][[1]]+points[[1]][[1]])/ 2,(points[[2]][[2]]+points[[1]][[2]])/2}]; halflength:= Table[{(points[[2]][[1]]-points[[1]][[1]])/ 2,(points[[2]][[2]]-points[[1]][[2]])/2}]; If[a\[LessEqual]1, Table[{(x-graphcenter[[1]])/halflength[[1]], a (Log[10,y]-graphcenter[[2]])/halflength[[2]]}], Table[{(x-graphcenter[[1]])/(a halflength[[1]]),(Log[10,y]- graphcenter[[2]])/halflength[[2]]}]]]; LogLinearLocate[points_,x_,y_,a_:0.612]:=Module[{graphcenter,halflength}, graphcenter:= Table[{(points[[2]][[1]]+points[[1]][[1]])/ 2,(points[[2]][[2]]+points[[1]][[2]])/2}]; halflength:= Table[{(points[[2]][[1]]-points[[1]][[1]])/ 2,(points[[2]][[2]]-points[[1]][[2]])/2}]; If[a\[LessEqual]1, Table[{(Log[10,x]-graphcenter[[1]])/halflength[[1]], a (y-graphcenter[[2]])/halflength[[2]]}], Table[{(Log[10,x]-graphcenter[[1]])/(a halflength[[1]]),(y- graphcenter[[2]])/halflength[[2]]}]]]; LinearLocate[points_,x_,y_,a_:0.612]:=Module[{graphcenter,halflength}, graphcenter:= Table[{(points[[2]][[1]]+points[[1]][[1]])/ 2,(points[[2]][[2]]+points[[1]][[2]])/2}]; halflength:= Table[{(points[[2]][[1]]-points[[1]][[1]])/ 2,(points[[2]][[2]]-points[[1]][[2]])/2}]; If[a\[LessEqual]1, Table[{(x-graphcenter[[1]])/halflength[[1]], a (y-graphcenter[[2]])/halflength[[2]]}], Table[{(x-graphcenter[[1]])/(a halflength[[1]]),(y-graphcenter[[2]])/ halflength[[2]]}]]]; SizeSpec[x_String,entrys_,a_:0.612]:= If[a\[LessEqual]1,{0.2+(Count[Characters[x],_])/40, 0.05 entrys/a},{0.2/a+(Count[Characters[x],_]+4)/(40 a), 0.05 entrys}]; End[]; Attributes[LogLogLocate]={ReadProtected}; Attributes[LinearLogLocate]={ReadProtected}; Attributes[LogLinearLocate]={ReadProtected}; Attributes[LinearLocate]={ReadProtected}; Attributes[SizeSpec]={ReadProtected}; EndPackage[] Null