Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #4156
| From | Heike Gramberg <heike.gramberg@gmail.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: LabelPlot: Changing size of CurveLabel |
| Date | 2011-08-03 11:14 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <j1bai1$ane$1@smc.vnet.net> (permalink) |
| 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?
>
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread
Re: LabelPlot: Changing size of CurveLabel Heike Gramberg <heike.gramberg@gmail.com> - 2011-08-03 11:14 +0000
csiph-web