Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

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

Search the Archive

Re: Using legend with FilledPlot

  • To: mathgroup at
  • Subject: [mg74435] Re: Using legend with FilledPlot
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at>
  • Date: Wed, 21 Mar 2007 02:50:43 -0500 (EST)
  • Organization: The Open University, Milton Keynes, UK
  • References: <etnju8$fuv$>

Michelasso wrote:
> 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.

That normal since the option PlotLegend is available for the functions 
Plot and MultipleListPlot *only*. However, you can use ShowLegend (also 
available from the package Legend) or use a combination of Text and Line 

> Is there any way to obtain a legend with FilledPlot?

You can use the option Epilog with Text and Line. For instance,

<< "Graphics`FilledPlot`";

FilledPlot[{Sin[x], Cos[x]}, {x, -3, 3}, PlotStyle -> {Hue[0.4], 
Hue[0.6]},  Epilog -> {Hue[0.4], Line[{{0.6, -0.3}, {1., -0.3}}], Black, 
Text[a, {1.2, -0.3}, {-1, 0}], Hue[0.6], Line[{{0.6, -0.5}, {1.,-0.5}}], 
Black, Text[b, {1.2, -0.5}, {-1, 0}]}];

[...graphic deleted...]


  • Prev by Date: Re: Function[x...] and #& not equivalent
  • Next by Date: Version 1.1 of A WorkLife FrameWork now available
  • Previous by thread: Re: Using legend with FilledPlot
  • Next by thread: Re: Using legend with FilledPlot