MathGroup Archive 2007

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

Search the Archive

Re: Using legend with FilledPlot

  • To: mathgroup at smc.vnet.net
  • Subject: [mg74424] Re: Using legend with FilledPlot
  • From: "dimitris" <dimmechan at yahoo.com>
  • Date: Wed, 21 Mar 2007 02:44:42 -0500 (EST)
  • References: <etnju8$fuv$1@smc.vnet.net>

=CF/=C7 Michelasso =DD=E3=F1=E1=F8=E5:
> Ok, I have tried to answer to myself to the previous questions I made,
> and I have almost managed to get what I want, except for one thing: I
> cannot put legend into grpahics I draw with FilledPlot funtion.
> For example this works:
>
> Plot[{Sin[x], Cos[x]}, {x, -3, 3}, PlotStyle -> {Hue[0.4], Hue[0.6]},
>   PlotLegend -> {"a", "b"}, LegendTextSpace -> 10,
>   LegendShadow -> None, LegendPosition -> {0.2, -0.3},
>   LegendSize -> {0.9, 0.2}]
>
> but if I replace Plot with FilledPlot I don't have anymore a legend.
> Is there any way to obtain a legend with FilledPlot?


Hello.

(*load the package*)
<< Graphics`FilledPlot`
(*change one default setting*)
$TextStyle = {FontFamily -> "Times"};
(*your filled plot; plot does not display alone because of
Block[[{$DisplayFunction = Identity}, ...] setting*)
g1 = Block[{$DisplayFunction = Identity}, FilledPlot[{Sin[x],
      Cos[x]}, {x, -Pi, Pi}, PlotStyle -> {Red, Blue}, Axes -> False,
     Frame -> {True, True, False, False}]];
(*"construct" your legend*)
g2 = {Text[TraditionalForm[Sin[x]], {-2.7, 0.25}],
Text[TraditionalForm[Cos[x]], {-2.7, 0.45}]};
g3 = {{Red, Line[{{-2.3, 0.25}, {-1.8, 0.25}}]}, {Blue, Line[{{-2.3,
0=2E45},
{-1.8, 0.45}}]}};
(*final graph*)
Show[g1, Graphics[{g2, g3}], ImageSize -> 400, FrameLabel ->
TraditionalForm
/@ {x, f[x]}, PlotLabel -> StyleForm["Michelasso's filled plot",
FontSize -> 14],
FrameTicks -> {Range[-Pi, Pi, Pi/2], Range[-1, 1, 0.5]}];
(*restore default settings*)
$TextStyle = {};

Regards
Dimitris



  • Prev by Date: Re: Integrate
  • Next by Date: Re: how to find complete integral of pde
  • Previous by thread: Re: Using legend with FilledPlot
  • Next by thread: simple sequence problem