Re: ScaledMultipleListPlot
- To: mathgroup at smc.vnet.net
- Subject: [mg13585] Re: ScaledMultipleListPlot
- From: tburton at brahea.com (Tom Burton)
- Date: Mon, 3 Aug 1998 03:53:48 -0400
- Organization: Brahea, Inc.
- References: <6pugm4$6ou@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
On 1 Aug 1998 03:38:44 -0400, in comp.soft-sys.math.mathematica you
wrote:
>Does anyone know of an easy way to extend the capabilities of
>MultipleListPlot to ScaledListPlots, ie. a MultipleListPlot on a
>LogLogScale, or a package that might do it? Thanks,
>Jason
Here's a modest improvement. I use it to extend MultipleListPlot to the
other three combinations of linear and logarithmic x and y axes.
Please note that I put the legend off the right. That's where I like it.
Feel free to move it. Also note that the syntax I have chosen does not
support implicit abcissas (x = {1,2..}).
Tom Burton
Notebook[{
Cell[CellGroupData[{
Cell["Multiple Log List Plots", "Section",
PageWidth->WindowWidth],
Cell[TextData[{
"This utility adapts the Standard Package function MultipleListPlot to
\
LogLinear and LogLog plots, etc. It is adapted from the listing of \
MultipleLogListPlot on page 331 of Wickham-Jones ",
StyleBox["Mathematica Graphics: Techniques & Applications. ",
FontSlant->"Italic"]
}], "Text",
PageWidth->WindowWidth],
Cell[BoxData[
RowBox[{"Needs", "[", "\"\<Graphics`Graphics`\>\"", "]"}]],
"Input"],
Cell[BoxData[
RowBox[{"Needs", "[", "\"\<Graphics`MultipleListPlot`\>\"", "]"}]],
"Input"],
Cell[BoxData[
RowBox[{
RowBox[{
RowBox[{
RowBox[{"MultipleLogListPlot", "::", "usage"}], "=", "\n",
"\t",
"\"\<MultipleLogListPlot[{data__},logQ_List<,opts>] extends \
MultipleListPlot to all four combinations of linear or log axes. e.g.,
\ logQ={True,False} for a LogLinear plot.\>\""}], ";"}], "\n"}]], =
"Input",
PageWidth->WindowWidth,
InitializationCell->True],
Cell[BoxData[
RowBox[{
RowBox[{
RowBox[{"MultipleLogListPlot", "[",
RowBox[{
RowBox[{"data", ":",
RowBox[{"{",
RowBox[{
RowBox[{"_", "?", "MatrixQ"}], ".."}], "}"}]}], ",",
"scales_List", ",",
RowBox[{"opts___", "?", "OptionQ"}]}], "]"}], ":=", "\n",
"\t",
RowBox[{"Module", "[",
RowBox[{
RowBox[{"{",
RowBox[{
RowBox[{"ldata", "=", "data"}], ",",
RowBox[{"tickSpecs", "=",
RowBox[{"{",
RowBox[{"Automatic", ",", "Automatic"}], "}"}]}]}],
"}"}], ",", "\n", "\t\t",
RowBox[{
RowBox[{"If", "[",
RowBox[{
RowBox[{"scales", "[",
RowBox[{"[", "1", "]"}], "]"}], ",", "\n", "\t\t\t",
RowBox[{
RowBox[{"ldata", "=",
RowBox[{"Apply", "[",
RowBox[{
RowBox[{
RowBox[{"{",
RowBox[{
RowBox[{"Log", "[",
RowBox[{"10", ",", "#1"}], "]"}], ",",
"#2"}], "}"}], "&"}], ",", "ldata", ",",
RowBox[{"{", "2", "}"}]}], "]"}]}], ";", "\n",
"\t\t\t",
RowBox[{
RowBox[{"tickSpecs", "[",
RowBox[{"[", "1", "]"}], "]"}], "=",
"LogScale"}]}]}], "]"}], ";", "\n", "\t\t",
RowBox[{"If", "[",
RowBox[{
RowBox[{"scales", "[",
RowBox[{"[", "2", "]"}], "]"}], ",", "\n", "\t\t\t",
RowBox[{
RowBox[{"ldata", "=",
RowBox[{"Apply", "[",
RowBox[{
RowBox[{
RowBox[{"{",
RowBox[{"#1", ",",
RowBox[{"Log", "[",
RowBox[{"10", ",", "#2"}], "]"}]}],
"}"}],
"&"}], ",", "ldata", ",",
RowBox[{"{", "2", "}"}]}], "]"}]}], ";", "\n",
"\t\t\t",
RowBox[{
RowBox[{"tickSpecs", "[",
RowBox[{"[", "2", "]"}], "]"}], "=",
"LogScale"}]}]}], "]"}], ";", "\n", "\t\t",
RowBox[{"MultipleListPlot", "[",
RowBox[{
RowBox[{"Sequence", " ", "@@", " ", "ldata"}], ",",
"opts",
",",
RowBox[{"Axes", "\[Rule]", "True"}], ",", "\n", " ",
RowBox[{"PlotJoined", "\[Rule]", "True"}], ",",
RowBox[{"Frame", "\[Rule]",
RowBox[{"{",
RowBox[{
"True", ",", "True", ",", "False", ",", "False"}],
"}"}]}], ",", "\n", " ",
RowBox[{"FrameTicks", "\[Rule]", "tickSpecs"}], ",",
RowBox[{"LegendShadow", "\[Rule]", "None"}], ",",
"\n",
" ",
RowBox[{"LegendPosition", "\[Rule]",
RowBox[{"{",
RowBox[{"1.0", ",",
RowBox[{"-", "0.3"}]}], "}"}]}], ",", "\n",
" ",
RowBox[{"SymbolShape", "\n", " ", "\[Rule]",
RowBox[{"{",
RowBox[{
RowBox[{"PlotSymbol", "[",
RowBox[{"Diamond", ",",
RowBox[{"Filled", "\[Rule]", "False"}]}],
"]"}],
",", "\n", " ",
RowBox[{"PlotSymbol", "[",
RowBox[{"Box", ",", "1.5", ",",
RowBox[{"Filled", "\[Rule]", "False"}]}],
"]"}]}], "}"}]}]}], "]"}]}]}], "]"}]}],
"\n"}]],
"Input",
PageWidth->WindowWidth,
InitializationCell->True],
Cell[CellGroupData[{
Cell["Local tests", "Subsection"],
Cell[BoxData[
RowBox[{
RowBox[{"SetOptions", "[",
RowBox[{"MultipleListPlot", ",",
RowBox[{"PlotLabel", "\[Rule]", "\"\<Two lines\>\""}], ",",
RowBox[{"AxesLabel", "\[Rule]",
RowBox[{"{",
RowBox[{"\"\<x\>\"", ",", "\"\<y\>\""}], "}"}]}], ",",
RowBox[{"PlotLegend", "\[Rule]",
RowBox[{"{",
RowBox[{"\"\<up\>\"", ",", "\"\<down\>\""}], "}"}]}]}],
"]"}],
";"}]], "Input"],
Cell[BoxData[
RowBox[{
RowBox[{"twoLines", "=",
RowBox[{"Transpose", "/@",
RowBox[{"{", "\n", "\t\t",
RowBox[{
RowBox[{"{",
RowBox[{
RowBox[{"{",
RowBox[{"1", ",", "2", ",", "3", ",", "4"}], "}"}],
",",
RowBox[{"{",
RowBox[{"2", ",", "4", ",", "6", ",", "8"}],
"}"}]}],
"}"}], ",", "\n", "\t\t\t",
RowBox[{"{",
RowBox[{
RowBox[{"{",
RowBox[{"2", ",", "3", ",", "4", ",", "5"}], "}"}],
",",
RowBox[{"{",
RowBox[{"5", ",", "4", ",", "3", ",", "2"}],
"}"}]}],
"}"}]}], "}"}]}]}], ";"}]], "Input"],
Cell["Linear linear plot (like MultipleListPlot)", "Text"],
Cell[BoxData[
RowBox[{
RowBox[{"logQ", "=",
RowBox[{"{",
RowBox[{"False", ",", "False"}], "}"}]}], ";"}]], "Input"],
Cell[BoxData[
RowBox[{
RowBox[{"MultipleLogListPlot", "[",
RowBox[{"twoLines", ",", "logQ"}], "]"}], ";"}]], "Input"],
Cell["Log Log Plot", "Text"],
Cell[BoxData[
RowBox[{
RowBox[{"logQ", "=",
RowBox[{"{",
RowBox[{"True", ",", "True"}], "}"}]}], ";"}]], "Input"],
Cell[BoxData[
RowBox[{
RowBox[{"MultipleLogListPlot", "[",
RowBox[{"twoLines", ",", "logQ"}], "]"}], ";"}]], "Input"],
Cell["Log Linear Plot", "Text"],
Cell[BoxData[
RowBox[{
RowBox[{"logQ", "=",
RowBox[{"{",
RowBox[{"True", ",", "False"}], "}"}]}], ";"}]], "Input"],
Cell[BoxData[
RowBox[{
RowBox[{"MultipleLogListPlot", "[",
RowBox[{"twoLines", ",", "logQ"}], "]"}], ";"}]], "Input"] },
Open ]]
}, Open ]]
},
FrontEndVersion->"Microsoft Windows 3.0", ScreenRectangle->{{0, 1280},
{0, 992}}, AutoGeneratedPackage->None,
WindowSize->{663, 710},
WindowMargins->{{Automatic, 80}, {Automatic, 29}}, Magnification->1.25
]