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


Groups > comp.soft-sys.math.mathematica > #15254

Re: Having difficulties improving Legend and plot

From Bob Hanlon <hanlonr357@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Having difficulties improving Legend and plot
Date 2013-07-27 08:20 +0000
Message-ID <ksvvsh$oqs$1@smc.vnet.net> (permalink)
References <20130726094654.4DE236A58@smc.vnet.net>
Organization Time-Warner Telecom

Show all headers | View raw


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@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@yahoo.com
>
>

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: Having difficulties improving Legend and plot Bob Hanlon <hanlonr357@gmail.com> - 2013-07-27 08:20 +0000

csiph-web