MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: LabelPlot: Changing size of CurveLabel

  • To: mathgroup at smc.vnet.net
  • Subject: [mg120672] Re: LabelPlot: Changing size of CurveLabel
  • From: Yves Klett <yves.klett at googlemail.com>
  • Date: Wed, 3 Aug 2011 07:06:51 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <j18mbp$soh$1@smc.vnet.net>

Hi,

seems slightly dated. The style options are hardcoded in the Module. A
quick´n dirty modification could be (pulling all the formatting into the
function call and replacing StyleForm with Style):


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[crvlbl[[i, 1]], {aa[i] = crvlbl[[i, 2]] (varmax - varmin),
        f[i][aa[i]]}, {0, -1}],
      Text[crvlbl[[i]], {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]]];

myplt3 = LabelPlot[{Sin[x], Cos[2 x]/3}, {x, 0, 2 \[Pi]},
  PlotStyle -> {Hue[.95], Hue[.7]},
  CurveLabel -> {{Style[ToString[adf], FontFamily -> "Arial",
      Background -> LightBlue, 25], 3/4}, f2[t]}]


You might want to set up a some default options for the Style calls. The
old module also calls ToString by default, which could affect advanced
expressions (fancy typesetting, grids etc.) somewhat bad.

Regards,
Yves



Am 02.08.2011 13:17, schrieb paulvonhippel at yahoo:
> 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?
> 




  • Prev by Date: Re: Memory leak or flawed garbage collector
  • Next by Date: Simple Doppler effect
  • Previous by thread: Re: LabelPlot: Changing size of CurveLabel
  • Next by thread: OpenCLQ failing