MathGroup Archive 2005

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

Search the Archive

Re: ShowLegend....

  • To: mathgroup at smc.vnet.net
  • Subject: [mg53634] Re: [mg53617] ShowLegend....
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Fri, 21 Jan 2005 06:35:40 -0500 (EST)
  • Reply-to: hanlonr at cox.net
  • Sender: owner-wri-mathgroup at wolfram.com

Needs["Graphics`Legend`"];

Plot[{10x+4,20x^2},{x,-0.4,0.4},
    PlotStyle->{Blue,{Red,AbsoluteDashing[{5,5}]}},
    PlotLegend->{"Normal","Data"},
    LegendPosition->{-0.8,0.15},
    LegendSize->0.5,
    ShadowBackground->GrayLevel[0.5],
    ImageSize->400];


Bob Hanlon

> 
> From: "plizak" <plizak at gmail.com>
To: mathgroup at smc.vnet.net
> Date: 2005/01/20 Thu AM 03:48:05 EST
> To: mathgroup at smc.vnet.net
> Subject: [mg53634] [mg53617] ShowLegend....
> 
> There has to be an easier way to do this....
> 
> I was trying to figure out how to use showlegend, and here's what I
> came out with....
> 
> (* plot2 and plot3 are two different plots *)
> 
> plotX = Show[ {plot2 , plot3}, PlotRange -> {{ -0.4, 0.4}, {-1, 10}}]
> 
> legend = ShadowBox[ {-0.4, 6}, {0.3, 3}, ShadowBackground -> GrayLevel[
> 0.5], ShadowOffset -> {0.025, -0.5}];
> 
> showlegend = Show[ plotX, Graphics[{legend , {
> Text["Normal - solid", {-.375, 6.775}, {-1.0, 0}],
> Text["Data - dashed", {-.375, 7.775}, {-1.0, 0}]
> }
> }
> ]
> ]
> 
> That is way to much code to just add a legend to a graph.
> 
> Is there a faster/easier way to do this?
> Is there a way that the legend also includes an example of the line /
> linestyle?  
> 
> Cheers and thanks,
> Peter
> 
> 


  • Prev by Date: compiling python 2.4 mathlink win32
  • Next by Date: Re: Newbie Programming question
  • Previous by thread: Re: ShowLegend....
  • Next by thread: Re: ShowLegend....