Re: LabelPlot: Changing size of CurveLabel
- To: mathgroup at smc.vnet.net
- Subject: [mg120675] Re: LabelPlot: Changing size of CurveLabel
- From: Heike Gramberg <heike.gramberg at gmail.com>
- Date: Wed, 3 Aug 2011 07:07:24 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <201108021113.HAA29405@smc.vnet.net>
If you remove the ToString[]'s from the definitions of LabelPlot you can use Style to change the style of the labels, i.e.
Clear[LabelPlot]
LabelPlot[func_List, {var_, varmin_, varmax_}, opts___?OptionQ] :=
Module[{crvlbl, pltopts, funclis, txt, tt, aa, f},
crvlbl = CurveLabel /. {opts} /. CurveLabel -> None;
pltopts = Select[{opts}, #[[1]] =!= CurveLabel &];
funclis =
Table[f[i][tt_] =
If[Head[func[[i]]] === Symbol && func[[i]] =!= var,
func[[i]][tt], func[[i]] /. var -> tt], {i, Length[func]}];
txt = Table[
If[Head[crvlbl[[i]]] === List,
Text[StyleForm[crvlbl[[i, 1]], Background -> GrayLevel[.95],
FontSize -> 10], {aa[i] = crvlbl[[i, 2]] (varmax - varmin),
f[i][aa[i]]}, {0, -1}],
Text[StyleForm[crvlbl[[i]], Background -> GrayLevel[.95],
FontSize -> 10], {aa[i] = (varmax - varmin)/2,
f[i][aa[i]]}, {0, -1}]], {i, Length[crvlbl]}];
Plot[Evaluate[Table[f[i][rr], {i, Length[func]}]], {rr, varmin,
varmax}, Epilog -> txt, Evaluate[pltopts]]
];
LabelPlot[func_, {var_, varmin_, varmax_}, opts___?OptionQ] :=
Module[{crvlbl, pltopts, f1, txt, tt, aa},
crvlbl = CurveLabel /. {opts} /. CurveLabel -> None;
pltopts = Select[{opts}, #[[1]] =!= CurveLabel &];
f1[tt_] =
If[Head[func] === Symbol && func =!= var, func[tt],
func /. var -> tt];
txt = If[Head[crvlbl] === List,
Text[StyleForm[crvlbl[[1]], Background -> GrayLevel[0.95],
FontSize -> 10], {aa = crvlbl[[2]] (varmax - varmin),
f1[aa]}, {0, -1}],
Text[StyleForm[crvlbl, Background -> GrayLevel[0.95],
FontSize -> 10], {aa = (varmax - varmin)/2, f1[aa]}, {0, -1}]];
Plot[f1[tt], {tt, varmin, varmax}, Epilog -> txt,
Evaluate[pltopts]]
]
myplt3 = LabelPlot[{Sin[x], Cos[2 x]/3}, {x, 0, 2 \[Pi]},
PlotStyle -> {Hue[.95], Hue[.7]},
CurveLabel -> { {Style[f1[t], 20, Orange,
Background -> LightOrange], 3/4}, Style[f2[t], 14, Blue]},
PlotRange -> {{0, 2 \[Pi]}, {-1, 1}}]
Heike
On 2 Aug 2011, at 12:13, paulvonhippel at yahoo wrote:
> Have you used the user-defined LabelPlot function? It's pretty cool:
> http://library.wolfram.com/infocenter/TechNotes/4116/
> But how do I change the size of the font used to display the labels in
> the CurveLabel option?
>
- References:
- LabelPlot: Changing size of CurveLabel
- From: paulvonhippel at yahoo <paulvonhippel@yahoo.com>
- LabelPlot: Changing size of CurveLabel