Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #12257 > unrolled thread

Re: A nice and customized legend within Manipulate

Started byAlexei Boulbitch <Alexei.Boulbitch@iee.lu>
First post2012-11-05 23:40 +0000
Last post2012-11-05 23:40 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Re: A nice and customized legend within Manipulate Alexei Boulbitch <Alexei.Boulbitch@iee.lu> - 2012-11-05 23:40 +0000

#12257 — Re: A nice and customized legend within Manipulate

FromAlexei Boulbitch <Alexei.Boulbitch@iee.lu>
Date2012-11-05 23:40 +0000
SubjectRe: A nice and customized legend within Manipulate
Message-ID<k79iol$8gk$1@smc.vnet.net>
Hello

I need to create a cdf document as a standalone file that can be used in
a computer without Mathematica.   There is quite a few plots in the doc
and I need to add nice legends to it.   At first I tried the Legend
package but I found the result awful and worse than that it breaks the
standalone cdf (something to do with Needs and Get or the like).

It seems that I need to add a initialization code within Manipulate but
I have no idea on how to do it.  Could someone help me with an example,
please?

Finally, is there a simple way to create nice legends?  I saw several
posts on the web but could not gather much from them.  A nice and simple
example (for a newbie) will help me a lot.

Many thanks

Ed

Hi, Ed,

Try this:

Plot[{x, x^2}, {x, -10, 10}, PlotRange -> All,
 PlotStyle -> {Blue, Red},

 (* Here the legend starts*)
 Epilog ->
  Inset[Grid[{{Graphics[{Blue, Line[{{0, 0}, {1, 0}}]},
       ImageSize -> {20, 20}],
      Style["First line",
       14]}, {Graphics[{Red, Line[{{0, 0}, {1, 0}}]},
       ImageSize -> {20, 20}], Style["Second line", 14]}},
    Alignment -> {Left, Center}, Spacings -> 0], {5, 80}]
 (* The end of the legend *)
         ]

and this:

(* These are two lists to plot *)
lst1 = Table[{x, x}, {x, -10, 10, 0.5}];
lst2 = Table[{x, x^2}, {x, -10, 10, 0.5}];
(* End of lists definition *)

ListPlot[{lst1, lst2}, PlotRange -> All, PlotStyle -> {Blue, Red},

 (* Here the legend starts*)
 Epilog ->
  Inset[Panel[
    Grid[{{Graphics[{Blue, Point[{0, 0}]}, ImageSize -> {20, 20}],
       Style["First list", 14]}, {Graphics[{Red, Point[{0, 0}]},
        ImageSize -> {20, 20}], Style["Second list", 14]}},
     Alignment -> {Left, Center}, Spacings -> 0],
    ImageSize -> {105, 80}], {4, 85}]
 (* The end of the legend *)
         ]

Have fun, Alexei




Alexei BOULBITCH, Dr., habil.
IEE S.A.
ZAE Weiergewan,
11, rue Edmond Reuter,
L-5326 Contern, LUXEMBOURG

Office phone :  +352-2454-2566
Office fax:       +352-2454-3566
mobile phone:  +49 151 52 40 66 44

e-mail: alexei.boulbitch@iee.lu



[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web