MathGroup Archive 2013

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

Search the Archive

Re: Having difficulties improving Legend and plot

  • To: mathgroup at smc.vnet.net
  • Subject: [mg131458] Re: Having difficulties improving Legend and plot
  • From: Bob Hanlon <hanlonr357 at gmail.com>
  • Date: Sat, 27 Jul 2013 05:38:34 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-outx@smc.vnet.net
  • Delivered-to: mathgroup-newsendx@smc.vnet.net
  • References: <20130726094654.4DE236A58@smc.vnet.net>

You are apparently not running the current version of Mathematica (v9). I
will  use v8.


$Version


"8.0 for Mac OS X x86 (64-bit) (October 5, 2011)"


Needs["PlotLegends`"];


Note that nested tables can be written as a single table with mutiple
iterators:


funcs = Table[
   A ((Log[n] - 1)/(Log[n] + 1)),
   {A, 300, 1000, 100},
   {n, 4, 2000, 2}];


You used an unnecessarily complicated method to reverse the order of the
functions:


{Sequence @@ (funcs[[#1]] &) /@
    {8, 7, 6, 5, 4, 3, 2, 1}} ==
 (funcs[[#]] & /@ {8, 7, 6, 5, 4, 3, 2, 1}) ==
 Reverse[funcs]


True


Alternatively, you could just decrement the table iterator:  {A, 1000, 300,
-100)


To smooth the plot, use lines rather than numerous PlotMarkers. Either add
the option Joined->True or use ListLinePlot rather than ListPlot. Either of
these will also use lines for the legends. Lines are easier to see than
just PlotMarkers and the lines will be the same thickness as the plot lines.

If you are going to use a legend shadow, I recommend that you tone it down
by using a lighter shade of gray.


ListLinePlot[Reverse[funcs],
 Frame -> True,
 Axes -> False,
 FrameLabel -> (Style[#, 14] & /@
    TraditionalForm /@ {n, f[A, n]}),
 PlotStyle -> ({AbsoluteThickness[2], #} & /@
    {Yellow, Red, Blue, Green,
     Orange, White, Black, Brown}), PlotLegend -> Range[1000, 300, -100],
 LegendLabel -> Style["Constant A", 12],
 LegendLabelSpace -> 1,
 LegendSpacing -> 0.01,
 ImageSize -> 800,
 LegendSize -> 1.0,
 LegendPosition -> {1.025, -0.225},
 ShadowBackground -> GrayLevel[.75],
 LegendBackground -> LightPurple,
 Background -> LightGray,
 Epilog -> Text[Style[
    f[A , n] == A ((Log[n] - 1)/(Log[n] + 1)) //
     TraditionalForm,
    14], {500, 100}]]



Bob Hanlon




On Fri, Jul 26, 2013 at 5:46 AM, Gilmar Rodriguez-pierluissi <
peacenova at yahoo.com> wrote:

>
> Dear Math Group:
>
> I'm having difficulties improving the following plot:
>
> Needs["PlotLegends`"];
>
> funcs = Table[Table[A ((Log[n] - 1)/(Log[n] + 1)), {n, 4, 2000, 2}], {A,
> 300, 1000, 100}];
>
> ListPlot[{Sequence @@ (funcs[[#1]] &) /@ {8, 7, 6, 5, 4, 3, 2, 1}},
> PlotStyle -> {Yellow, Red, Blue, Green, Orange, White, Black, Brown},
> PlotLegend -> {"1000", "900", "800", "700", "600", "500", "400", "300"},
>  LegendLabel -> "Constant A",
>  LegendLabelSpace -> 1,
>  LegendSpacing -> 0.01,
>  ImageSize -> 800,
>  LegendSize -> 1.0,
>  LegendPosition -> {1.15, -0.25},
>  ShadowBackground -> Gray,
>  LegendBackground -> LightPurple,
>  Background -> LightGray]
>
> (1.) The smooth function curves look serrated in the plot.
>
> (2.) When one attempts to add the option: "PlotMarkers->Automatic"; the
> ListPlot program malfunctions.
>
> (3.) I also want to increase the size of the markers in the Legend but,
> there doesn't seem to be an option
>       available to accomplish this.
>
> Please, help me to improve this plot.  Thanks!
>
> Gilmar Rodr=EDguez-Pierluissi
> peacenova at yahoo.com
>
>


  • Prev by Date: Re: keep special functions unexpanded
  • Next by Date: Re: "Complement" to the Risch Algorithm
  • Previous by thread: Having difficulties improving Legend and plot
  • Next by thread: Re: Having difficulties improving Legend and plot