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


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

Something other than PlotStyle to change look of graphs

Started bycylurian <cylurian@gmail.com>
First post2012-02-08 10:26 +0000
Last post2012-02-10 10:51 +0000
Articles 2 — 2 participants

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


Contents

  Something other than PlotStyle to change look of graphs cylurian <cylurian@gmail.com> - 2012-02-08 10:26 +0000
    Re: Something other than PlotStyle to change look of graphs Chris Young <cy56@comcast.net> - 2012-02-10 10:51 +0000

#8384 — Something other than PlotStyle to change look of graphs

Fromcylurian <cylurian@gmail.com>
Date2012-02-08 10:26 +0000
SubjectSomething other than PlotStyle to change look of graphs
Message-ID<jgtil7$67p$1@smc.vnet.net>
I have three functions in one plot.  I'm using PlotStyle to
differentiate the graphs, but I need more options.  I need each graph
to have some special marker, like a diamond, circle, etc.  I'm using
Mathematica 8 and I'm also using PlotLegend.  Any suggestions?

My code is:

Plot[{SurvivalFunction[WeibullDistribution[2.2, 3.2], x],
  SurvivalFunction[LogNormalDistribution[.1, .8], x],
  SurvivalFunction[ExponentialDistribution[.6], x]}, {x, 0, 5},
 PlotStyle -> {{ Black, Thickness[Small]}, {Dashing[Tiny],
    Black}, {Dashing[Large], Black, Thickness[Large]}},
 AxesLabel -> TraditionalForm /@ {t, "S(t)"}, Ticks -> None,
 DisplayFunction -> Identity,
 PlotLabel -> Style["Survival Curves", FontSize -> 18],
 PlotLegend -> {"Weibull", "LogNormal", "Exponential"},
 LegendPosition -> {.3, -0.1}, LegendTextSpace -> 4,
 LegendLabelSpace -> .5, LegendLabel -> "Survival Curves",
 LegendOrientation -> Vertical, LegendBackground -> White,
 LegendSize -> .4, ShadowBackground -> White]

thx.

[toc] | [next] | [standalone]


#8444

FromChris Young <cy56@comcast.net>
Date2012-02-10 10:51 +0000
Message-ID<jh2ss0$ir$1@smc.vnet.net>
In reply to#8384
I'm still working out the details here, but here's a more general
approach to using plot legends via Legend[ ]:


fncs[x_] := {
  SurvivalFunction[WeibullDistribution[2.2, 3.2], x],
  SurvivalFunction[LogNormalDistribution[0.1, 0.8], x],
  SurvivalFunction[ExponentialDistribution[0.6], x]
  }

plotStyles = {
  {Black, Thickness[Small]},
  {Dashing[Tiny], Black},
  {Dashing[Large], Black, Thickness[Large]}
  }

plotNames = {"Weibull", "LogNormal", "Exponential"}


GraphicsRow[
 {
  Show[
   Plot[
    fncs[x] // Evaluate,
    {x, 0, 5},
    PlotStyle -> plotStyles
    ],

   ListPlot[
    Transpose[Table[fncs[x], {x, 1, 5}]],
    PlotMarkers -> Automatic,
    Axes -> True
    ],

   PlotLabel -> Style["Survival Curves", FontSize -> 12],
   AxesLabel -> TraditionalForm /@ {"t", "S(t)"}
   ],

  Graphics @
   Legend[
    Table[
     {
      Graphics @ Append[plotStyles[[i]], Line[{{0, 0}, {2, 0}}]],
      plotNames[[i]]
      },
     {i, 1, 3}
     ],

    LegendPosition -> {0.3, -0.1},
    LegendTextSpace -> 1,
    LegendSize -> {0.25, 0.25},
    LegendOrientation -> Vertical,
    LegendBackground -> LightYellow,
    ShadowBackground -> LightOrange
    ]
  }
 ]

On 2012-02-08 10:26:47 +0000, cylurian said:

> I have three functions in one plot.  I'm using PlotStyle to
> differentiate the graphs, but I need more options.  I need each graph
> to have some special marker, like a diamond, circle, etc.  I'm using
> Mathematica 8 and I'm also using PlotLegend.  Any suggestions?
>
> My code is:
>
> Plot[{SurvivalFunction[WeibullDistribution[2.2, 3.2], x],
>   SurvivalFunction[LogNormalDistribution[.1, .8], x],
>   SurvivalFunction[ExponentialDistribution[.6], x]}, {x, 0, 5},
>  PlotStyle -> {{ Black, Thickness[Small]}, {Dashing[Tiny],
>     Black}, {Dashing[Large], Black, Thickness[Large]}},
>  AxesLabel -> TraditionalForm /@ {t, "S(t)"}, Ticks -> None,
>  DisplayFunction -> Identity,
>  PlotLabel -> Style["Survival Curves", FontSize -> 18],
>  PlotLegend -> {"Weibull", "LogNormal", "Exponential"},
>  LegendPosition -> {.3, -0.1}, LegendTextSpace -> 4,
>  LegendLabelSpace -> .5, LegendLabel -> "Survival Curves",
>  LegendOrientation -> Vertical, LegendBackground -> White,
>  LegendSize -> .4, ShadowBackground -> White]


[toc] | [prev] | [standalone]


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


csiph-web