MathGroup Archive 2009

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

Search the Archive

Re: Re: inconsistent synatx for FillingStyle

  • To: mathgroup at smc.vnet.net
  • Subject: [mg103174] Re: [mg103132] Re: [mg103115] inconsistent synatx for FillingStyle
  • From: Thomas Dowling <thomasgdowling at gmail.com>
  • Date: Thu, 10 Sep 2009 07:17:00 -0400 (EDT)
  • References: <21072336.1252406882479.JavaMail.root@n11>

Hello,

I agree with David Park who gives a very neat solution. I am not a big fan of
ListPlot myself as sooner or later you seem to run into a problem in that it
won't do something you expect should be easy.

Nevertheless, ListPlot is useful and one could use the following, perhaps?

ListPlot[{{{1, 1}}, {{2, 3}}},
 Filling -> {1 -> {Axis, Blue}, 2 -> {Axis, Red}},
 AxesOrigin -> {0, 0}]

Good luck

Tom Dowling

On Wed, Sep 9, 2009 at 9:41 AM, David Park <djmpark at comcast.net> wrote:

> Nasser,
>
> Sometimes it is such a chore to screw around a set-piece plot to a custom
> plot. (But some people on this list are good at it.) If each line is to
> have
> its own custom style why not abandon ListPlot and do something like this:
>
> filledLine[color_, {x_, y_}] := {color,
>  Style[Line[{{x, y}, {x, 0}}], Antialiasing -> False],
>  Directive[color, AbsolutePointSize[4]], Point[{x, y}]}
>
> Graphics[{filledLine @@@ {{Red, {1, 1}}, {Blue, {2, 3}}}},
>  AspectRatio -> .6,
>  Frame -> True,
>  PlotRange -> {{-.1, 2.2}, {0, 3.2}}]
>
> You could allow more style options in the filledLine routine, depending on
> your needs. Since all the filled lines are vertical we can make them
> crisper
> using the Antialiasing option.
>
>
> David Park
> djmpark at comcast.net
> http://home.comcast.net/~djmpark/ <http://home.comcast.net/%7Edjmpark/>
>
>
> From: Nasser Abbasi [mailto:nma at 12000.org]
>
> Problem: Make a ListPlot, and have each Point be a different color.
> Solution: Use Directive
>
> ListPlot[{{{1, 1}}, {{2, 3}}},
>    PlotStyle -> {Directive[Red], Directive[Blue]},
>   AxesOrigin -> {0, 0}]
>
> Problem : Make a ListPlot, but with vertical lines, and have each line be a
> different color.
>
> You would expect the synatx to be the same as above, just use Filling->Axis
> and use FillingStyle-> insteadl of PlotStyle->, right? But it does not work
>
> Solution attempt:
>
> ListPlot[{{{1, 1}}, {{2, 3}}},
>  Filling -> Axis,
>  FillingStyle -> {Directive[Red], Directive[Blue]},
>  AxesOrigin -> {0, 0}]
>
> Now I looked at help, and it says:
>
> "Directives can be combined using Directive[g1,g2,....]"
>
> So, I tried this
>
> ListPlot[{{{1, 1}}, {{2, 3}}},
> Filling -> Axis,
>  FillingStyle -> Directive[Red, Blue],
>  AxesOrigin -> {0, 0}]
>
> And this did not work either. I also tried
>
> ListPlot[{{{1, 1}}, {{2, 3}}},
>  FillingStyle -> {Red, Blue},
>  AxesOrigin -> {0, 0},
>  Filling -> Axis]
>
> I also tried
>
> ListPlot[{{{1, 1}}, {{2, 3}}},
>  FillingStyle -> Directive[{Red, Blue}],
>  AxesOrigin -> {0, 0},
>  Filling -> Axis]
>
> Am I getting any closer? I tried above 10 other ways, and can't get it to
> do
>
> this. so I give up :)
>
> Any idea how to make each vertical line be colored differently according to
> my own list of colors?
>
> thanks,
> --Nasser
>
>
>
>
>
>
>
>


  • Prev by Date: Re: NIntegrate when integral is zero
  • Next by Date: Re: Inconsistent behaviour of StudentTDistribution
  • Previous by thread: Re: Credit card balance transfer fee problem
  • Next by thread: SendMail[] on Linux platform not working