Test cases for MultipleLogListPlot  and LegendSpec

This is a test bed for MultipleLogListPlot  and LegendSpec.  Note that the input syntax for MultipleLogListPlot is exactly as in MultipleListPlot.  In fact, MultipleLogListPlot looks, feels, smells and acts just like MultipleListPlot.  The defaults for PlotRange, AxesOrigin, Gridlines and Ticks should work for most applications.  Remember that if the Frame option is chosen, you must specify FrameTicks.

John Taylor

Initialization

<< MultipleLogListPlot`;

<< LegendSpec`

Here are my standard test functions.  They are all exercised.

shortlinearlist := 
        Table[{i, 2 i}, {i, 0, 5}];
linearlist := 
        Table[{{i, i}, {{-0.1 i, 0.2 i}}}, {i, 1, 
            5}];
biglinearlist := 
        Table[{{i, 
              2 i}, {{-0.1 i, 0.2 i}, {-0.1 i, 0.2 i}}}, {i, 2, 
            5}];
linearsample := 
        Sequence @@ 
          Table[{shortlinearlist, linearlist, biglinearlist}];

linearlogtab1 := 
        Table[{0.1 i - 2, Exp[(0.1 i - 2)]}, {i, 0, 
            50}];
linearlogtab2 := 
        Table[{0.1 i - 2, Exp[(-0.1 i + 2)]}, {i, 0, 
            50}];
linearlogtab3 := 
        Table[{{0.1 i, Exp[-0.1 i]}, 0.2 Exp[-0.1 i]}, {i, 0, 
            30}];
linearlogtab4 := 
        Table[{0.1 i, Exp[(-0.1 i)]}, {i, 0, 
            30}];
linearlogtab5 := 
        Table[{0.1 i, Exp[(-0.1 i)]}, {i, 15, 
            30}];
loglineartab1 := 
        Table[{i, i}, {i, 1, 10}];
loglineartab2 := 
        Table[{i, N[Sqrt[i]]}, {i, 1, 10}];
loglineartab3 := 
        Table[{{i, Sqrt[i] + Random[Real, {-0.2, 0.2}]}, 0.1}, {i, 1, 
            10}];
loglineartab4 := 
        Table[{0.5 i, 0.5 i - 2}, {i, 1, 10}];
lineartab1 := 
        Table[{0.2  i, (0.2 i)^3/(Exp[0.2 i] - 1)}, {i, 1, 
            50}];
lineartab2 := 
        Table[{0.2  i, (0.2 i)^3/(Exp[0.15 i] - 1)}, {i, 1, 
            50}];
lineartab3 := Table[{0.1 i, 0.1 i}, {i, 3, 15}];

shortlinearloglist := 
        Table[{i, Exp[i/3]}, {i, 3, 10}];
linearloglist := 
        Table[{{i, Exp[i/2]}, 0.25 Exp[i/2]}, {i, 2, 
            10}];
longlinearloglist := 
        Table[{{i, 0.1  Exp[i]}, {0.5, 0.05  Exp[i]}}, {i, 1, 
            10}];
linearlogsample := 
      Sequence @@ 
        Table[{shortlinearloglist, linearloglist, 
            longlinearloglist}]

shortloglinearlist := 
        Table[{2 i, Log[10, 2 i]}, {i, 3, 
            50}];
loglinearlist := 
        Table[{{2 i, 2 Log[10, 2 i]}, 0.2 Log[10, 2 i]}, {i, 4, 
            50}];
longloglinearlist := 
        Table[{{2 i, 3 Log[10, 2 i]}, {0.3 i, 0.25 Log[10, 2 i]}}, {i, 
            1, 50}];
loglinearsample := 
      Sequence @@ 
        Table[{shortloglinearlist, loglinearlist, 
            longloglinearlist}]

hugelogloglist := 
        Table[{{100 i, (100 i)^3}, 0.5 (100 i)^3}, {i, 3, 
            20}];
hugeshortlogloglist := 
        Table[{100 i, (100 i)^4}, {i, 5, 
            20}];
hugelonglogloglist := 
        Table[{{100 i, (100 i)^2}, {0.25 ( 100 i), 
              0.75 (100 i)^2}}, {i, 5, 
            20}];
hugeloglogsample := 
        Sequence @@ 
          Table[{hugelogloglist, hugeshortlogloglist, 
              hugelonglogloglist}];

minilogloglist := 
        Table[{{i/10, (i/10)^3}, 0.25 (i/10)^3}, {i, 3, 
            20}];
minishortlogloglist := 
        Table[{i/10, (i/10)^4}, {i, 5, 20}];
minilonglogloglist := 
        Table[{{i/10, (i/10)^2}, {0.1 ( i/10), 
              0.25 (i/10)^2}}, {i, 5, 20}];
miniloglogsample := 
        Sequence @@ 
          Table[{minilogloglist, minishortlogloglist, 
              minilonglogloglist}];

logloglist := 
        Table[{{i, i^3}, 0.25 i^3}, {i, 3, 
            20}];
shortlogloglist := 
        Table[{i, i^4}, {i, 5, 20}];
longlogloglist := 
        Table[{{i, i^2}, {0.25 i, 0.75 i^2}}, {i, 5, 
            20}];
loglogsample := 
        Sequence @@ 
          Table[{logloglist, shortlogloglist, longlogloglist}];

shorttinylogloglist := 
      Table[{i/1000, (i/1000)^2}, {i, 1, 11}]

Graphs

This cell demonstrates the default axes origin on a LinearLog graph when all linear coordinates are positive.

MultipleLinearLogPlot[linearlogtab5, PlotJoined -> True, 
        SymbolShape -> None, PlotStyle -> {AbsoluteThickness[2]}, 
        AxesLabel -> {"X Axis", "Y Axis\n"}, 
        ImageSize -> 7.5 72];

This cell demonstrates the default axis origin when some linear coordinates are negative.

MultipleLinearLogPlot[linearlogtab1, PlotJoined -> True, 
        SymbolShape -> None, PlotStyle -> {AbsoluteThickness[2]}, 
        AxesLabel -> {"X Axis", "Y Axis\n"}, 
        ImageSize -> 7.5 72];

This cell demonstrates the use of the built in LegendPositionfunction LinearLogCorner.Note that the input argument contains a List of functions,rather than a Sequence.The next two arguments are the physical coordinates of the desired LegendPosition. A fourth argument (a),not used for this demonstration,is defaulted to 0.612 for a plot whose AspectRatio is Automatic. Note that the LegendPosition achieved is not precise,but close.This is due to the fact that there is a built in average over possible AxesLabels and other text added to the Graphic.It is this imprecision that spawned the creation of the LegendSpec package.

MultipleLinearLogPlot[Take[linearlogtab1, 21], linearlogtab3, 
        PlotJoined -> {True, False}, 
        SymbolShape -> {None, RedSymbol[colordiamond[0.01]]}, 
        ErrorBarFunction -> {None, RedSerif}, 
        PlotStyle -> {AbsoluteThickness[2]}, 
        AxesLabel -> {"X ", "Y Axis\n"}, 
        AxesOrigin -> {0, Log[10, 0.04]}, 
        Epilog -> {Text["Added Line", {0.5, Log[10, 0.03]}]}, 
        PlotRange -> All, ImageSize -> 7.5 72, 
        PlotLegend -> {"testcurve", "testpoints"}, 
        LegendPosition -> 
          LinearLogCorner[{Take[linearlogtab1, 21], linearlogtab3}, 1.0, 
            0.5], LegendSize -> {0.45, 0.1}, 
        ImageSize -> 7.5 72];

New we exercise the package LegendSpec by reading the cornerpoints off the plot above and recording them as cornerpoints1.

cornerpoints1 := {{-2.50715, -1.53626}, {3.81301, 
            0.329769}};

MultipleLinearLogPlot[Take[linearlogtab1, 21], linearlogtab3, 
        PlotJoined -> {True, False}, 
        SymbolShape -> {None, RedSymbol[colordiamond[0.01]]}, 
        ErrorBarFunction -> {None, RedSerif}, 
        PlotStyle -> {AbsoluteThickness[2]}, 
        AxesLabel -> {"X ", "Y Axis\n"}, 
        AxesOrigin -> {0, Log[10, 0.04]}, 
        Epilog -> {Text["Added Line", {0.5, Log[10, 0.03]}]}, 
        ImageSize -> 7.5 72, 
        PlotLegend -> {"testcurve", "testpoints"}, 
        PlotRange -> All, 
        LegendPosition -> LinearLogLocate[cornerpoints1, 1.0, 0.5], 
        LegendSize -> SizeSpec["testpoints   ", 2], 
        LegendSize -> {0.45, 0.1}, 
        ImageSize -> 7.5 72];

MultipleLinearLogPlot[linearlogtab1, linearlogtab4, 
        PlotJoined -> True, SymbolShape -> None, 
        PlotStyle -> {{AbsoluteThickness[2], RGBColor[1, 0, 0]}, 
            AbsoluteThickness[2]}, 
        AxesLabel -> {"X Axis", "Y Axis\n"}, 
        ImageSize -> 7.5 72, 
        PlotLegend -> {"tab1", "tab4"}, 
        LegendPosition -> 
          LinearLogCorner[{linearlogtab1, linearlogtab4}, 1.5, 0.5], 
        LegendSize -> {0.25, 0.1}];

points1 := {{-2.37718, -1.45604}, {4.09896, 
            1.70897}};

MultipleLinearLogPlot[linearlogtab1, linearlogtab4, 
        PlotJoined -> True, SymbolShape -> None, 
        PlotStyle -> {{AbsoluteThickness[2], RGBColor[1, 0, 0]}, 
            AbsoluteThickness[2]}, 
        AxesLabel -> {"X Axis", "Y Axis\n"}, 
        ImageSize -> 7.5 72, 
        PlotLegend -> {"tab1", "tab4"}, 
        LegendPosition -> LinearLogLocate[points1, 1.5, 0.5], 
        LegendSize -> {0.25, 0.1}];

This cell demonstrates the use of LinearLogCorner in conjunction with input data containing error bars and in addition,an Epilog which introduces text below the abcissa tick labels. Note especially that the addition of this Epilog requires PlotRange->All. Note how the addition of the extra line changes the error in location of the Legend.Further,the AxesOrigin must now be specified to get the plot to look right.

The next cell exercises the system in the mid range. of log log coordinates.

MultipleLogLogPlot[miniloglogsample, 
        SymbolShape -> {RedSymbol[colortriangle[0.025]], 
            GreenSymbol[colordiamond[0.025]], BlueSymbol[colorstar[0.025]]}, 
        ErrorBarFunction -> {RedBar, GreenBar, BlueBar}];

MultipleLogLogPlot[hugeloglogsample, 
        SymbolShape -> {RedSymbol[colortriangle[0.025]], 
            GreenSymbol[colordiamond[0.025]], BlueSymbol[colorstar[0.025]]}, 
        ErrorBarFunction -> {RedBar, GreenBar, BlueBar}];

This cell exercises very small numbers  and the colorpoint function.  There are no errors for this input, so this is suitable test for plotting a theoretical curve.  Note that if we specify RedBar (no Serif) the errorbar function produces no result.

MultipleLogLogPlot[shorttinylogloglist, 
        SymbolShape -> RedSymbol[colorpoint], 
        ErrorBarFunction -> RedBar, PlotJoined -> True, 
        PlotStyle -> RGBColor[1, 0, 0]];

This cell checks the linear log plot option.  Note that the default  AxesOrigin and PlotRange cuts off the error bars at the origin and on the top.

MultipleLinearLogPlot[linearlogsample, 
        SymbolShape -> {RedSymbol[colortriangle[0.015]], 
            GreenSymbol[colordiamond[0.015]], 
            BlueSymbol[colorpentagon[0.015]]}, 
        PlotJoined -> {True, False, False}, 
        PlotStyle -> {RGBColor[1, 0, 0], RGBColor[0, 1, 0], 
            RGBColor[0, 0, 1]}, 
        ErrorBarFunction -> {RedBar, GreenSerif, 
            BlueSerif}];

Here is the same data with  specification of the origin and range.  Remember that MultipleListPlot is doing Linear plotting, so negative numbers are OK.

MultipleLinearLogPlot[linearlogsample, 
        AxesOrigin -> {0, -1}, 
        PlotRange -> {{0, 11}, {-1, 3.5}}, 
        SymbolShape -> {RedSymbol[colortriangle[0.015]], 
            GreenSymbol[colordiamond[0.015]], 
            BlueSymbol[colorpentagon[0.015]]}, 
        PlotJoined -> {True, False, False}, 
        PlotStyle -> {RGBColor[1, 0, 0], RGBColor[0, 1, 0], 
            RGBColor[0, 0, 1]}, 
        ErrorBarFunction -> {RedBar, GreenSerif, 
            BlueSerif}];

The next cell cxercises the log linear plot option and the error bars without serifs.

MultipleLogLinearPlot[loglinearsample, 
        SymbolShape -> {OrangeSymbol[colordiamond[0.015]], 
            BlackSymbol[colorstar[0.02]], YellowSymbol[colortriangle[0.02]]}, 
        ErrorBarFunction -> {OrangeBar, BlackBar, 
            YellowBar}];

The following plot points up the problem of locating a Legend for plots where the range is very  large.  I can't find any algorithmic way to do it.

\(\(MultipleLogLinearPlot[loglinearsample, 
        GridLines -> {LooseMultipleLogGrid[0, 2], 
            Automatic}, 
FrameTicks -> {LooseMultipleLogTicks[0, 2], 
            Automatic}, 
SymbolShape -> {RedSymbol[
              colortriangle[0.015]], GreenSymbol[colordiamond[0.015]], 
            BlueSymbol[
              colorstar[
                0.015]]}, 
ErrorBarFunction -> {RedSerif, GreenSerif, 
            BlueSerif}, 
PlotLegend -> {"noerror", "y error", "x,y error"}, 
LegendPosition -> {\(-0.65\), 0.2}, 
        LegendTextSpace -> 
          1, 
LegendSize -> {0.9, 
            0.25}, 
Frame -> 
          True, 
PlotLabel -> "MultipleLogLinearPlot", PlotJoined -> 
          True, 
PlotStyle -> {RGBColor[1, 0, 0], 
            RGBColor[0, 1, 0], 
            RGBColor[0, 0, 1]}, 
FrameLabel -> {x, 
            y}];\)\)

This cell tests the unequal positive and negative error bars,with serifs.

MultipleLinearPlot[linearsample, 
        SymbolShape -> {BlackSymbol[colorstar[0.02]], 
            RedSymbol[colorpentagon[0.01]]}, 
        ErrorBarFunction -> {BlackSerif, RedSerif}];

Note that in the next cell I have chosen  to join the data points for only one of the sets.  This is done by specifying the PlotJoined option for each set.  If you have a theoretical curve, with no error bars, use the simple errorbar  (RedBar,GreenBar, ...etc.) function for such a curve.  If you use the Serif functions, crosses will appear at the data points which generate the curve.

\(\(MultipleLinearLogPlot[linearlogsample, 
        GridLines -> {{0, 2, 4, 6, 8, 10}, 
            LooseMultipleLogGrid[\(-1\), 
              3]}, 
FrameTicks -> {Automatic, 
            LooseMultipleLogTicks[\(-1\), 
              2]}, 
Frame -> 
          True, 
LegendTextSpace -> 
          1, 
SymbolShape -> {RedSymbol[
              colortriangle[0.015]], GreenSymbol[colordiamond[0.015]], 
            BlueSymbol[
              colorstar[
                0.015]]}, 
ErrorBarFunction -> {RedBar, GreenBar, 
            BlueBar}, 
PlotLegend -> {"noerror", "y error", "x y error"}, 
LegendPosition -> {\(-0.3\), \(-0.45\)}, 
        LegendTextSpace -> 
          1, 
LegendSize -> {1.0, 
            0.2}, 
PlotLabel -> "MultipleLinearLogPlot", 
        PlotJoined -> {False, True, 
            False}, 
PlotStyle -> {RGBColor[1, 0, 0], 
            RGBColor[0, 1, 0], 
            RGBColor[0, 0, 1]}, 
FrameLabel -> {x, 
            y}];\)\)

In the next cell, we again over ride the AxesOrigin and PlotRange defaults.  Note that the Serifs are useful because some of the error bars lie on the grid lines.

\(\(MultipleLinearLogPlot[linearlogsample, AxesOrigin -> {0, \(-1\)}, 
        PlotRange -> {{0, 11}, {\(-1\), 
              3.5}}, 
FrameTicks -> {Automatic, 
            LooseMultipleLogTicks[\(-1\), 
              2]}, 
Frame -> 
          True, 
LegendTextSpace -> 
          1, 
SymbolShape -> {RedSymbol[
              colortriangle[0.015]], GreenSymbol[colordiamond[0.015]], 
            BlueSymbol[
              colorstar[
                0.015]]}, 
ErrorBarFunction -> {RedSerif, GreenSerif, 
            BlueSerif}, 
PlotLegend -> {"noerror", "y error", "x y error"}, 
LegendPosition -> {\(-0.3\), \(-0.45\)}, 
        LegendTextSpace -> 
          1, 
LegendSize -> {1.0, 
            0.2}, 
PlotLabel -> "MultipleLinearLogPlot", 
        PlotJoined -> {False, True, 
            False}, 
PlotStyle -> {RGBColor[1, 0, 0], 
            RGBColor[0, 1, 0], 
            RGBColor[0, 0, 1]}, 
FrameLabel -> {x, 
            y}];\)\)

MultipleLogLogPlot[shorttinylogloglist, 
        SymbolShape -> RedSymbol[colorpoint], 
        ErrorBarFunction -> RedBar, PlotJoined -> True, 
        PlotStyle -> RGBColor[1, 0, 0], Frame -> True, 
        FrameTicks -> {TightMultipleLogTicks[-3, -2], 
            LooseMultipleLogTicks[-6, -4]}, 
        Epilog -> {Text["abcissa", {-1.85, -6.25}], 
            Text["ordinate", {-3.2, -4.5}, {-1, 0}, {0, 
                1}]}];

MultipleLogLogPlot[shorttinylogloglist, 
        SymbolShape -> RedSymbol[colorpoint], 
        ErrorBarFunction -> RedBar, PlotJoined -> True, 
        PlotStyle -> RGBColor[1, 0, 0], Frame -> True, 
        FrameTicks -> {TightMultipleLogTicks[-3, -2], 
            LooseMultipleLogTicks[-6, -4]}, 
        Epilog -> {Text["abcissa", {-1.85, -6.25}], 
            Text["ordinate", {-3.2, -4.5}, {-0.5, 0}, {0, 
                1}]}];