Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

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

Search the Archive

Re: conditional plotstyles in ListPlot [additional note]

  • To: mathgroup at smc.vnet.net
  • Subject: [mg73375] Re: conditional plotstyles in ListPlot [additional note]
  • From: "dimitris" <dimmechan at yahoo.com>
  • Date: Wed, 14 Feb 2007 05:23:39 -0500 (EST)
  • References: <eqs9ck$il2$1@smc.vnet.net>

I hope I have undestood well what you want.

Anyway, consider the following list of (pseudo-) random data
(everything is converted to InputForm via Shift+Ctrl+I)

lst = Table[{i, Random[]}, {i, 20}]
{{1, 0.7398002254042386}, {2, 0.48351136238411035}, {3,
0=2E6990879133175131}, {4, 0.9079168297300548}, {5,
0=2E6053785686483808},
  {6, 0.10045411927452741}, {7, 0.7367259846597651}, {8,
0=2E4295409119605975}, {9, 0.677755292547973}, {10,
0=2E5396708362542667},
  {11, 0.6683277939079364}, {12, 0.7456532011620224}, {13,
0=2E861128274213798}, {14, 0.9028288270968751},
  {15, 0.35696122270866637}, {16, 0.47048545503420414}, {17,
0=2E30724914917473006}, {18, 0.5872985438246565},
  {19, 0.5365153020570516}, {20, 0.7535043198811145}}

A possible plot without splitting it could as follows:

ListPlot[lst, PlotJoined ->
  True, PlotStyle -> {Green,
    AbsoluteDashing[{2, 3}]}, Frame -> True, Axes -> False,
  PlotRange -> {-0.02, 1.02}, Epilog -> {Magenta,
   AbsolutePointSize[5], Point /@ lst}]

Supposing you have to split in the middle of the list you could work
as follows

lst1 = Take[lst, 10];
lst2 = Take[lst, -10];

Block[{$DisplayFunction = Identity}, gr1 = ListPlot[lst1, PlotJoined -
> True, PlotStyle -> {Red, AbsoluteDashing[{3, 5}]},
     Frame -> True, Axes -> False, PlotRange -> {-0.02, 1.02}, Epilog -
> {Red, AbsolutePointSize[5], Point /@ lst}];
   gr2 = ListPlot[lst2, PlotJoined -> True, PlotStyle -> {Blue,
AbsoluteDashing[{4, 3}]}, Frame -> True, Axes -> False,
     PlotRange -> {-0.02, 1.02}, Epilog -> {Blue,
AbsolutePointSize[5], Point /@ lst}]; ]
Show[{gr1, gr2}]

Of course there are also other alternatives and you can modify as you
wish the look of your plot.


Best Regards
Dimitris

=CF/=C7 Stern =DD=E3=F1=E1=F8=E5:
> If I split the list in two, each to be graphed separately and then
> combined on a single axis, how would it be possible to connect the
> dots? The two graphs would have separate links, and dots in the red
> series (for example) would not connect to dot in the blue series (for
> example), even if they are adjacent to each other on the x-axis.
>
> Thanks for any help,
>
> Michael
>
>
>
> On 2/12/07, Stern <nycstern at gmail.com> wrote:
> > I am plotting a time series and would like to use different colors for
> > points above the x-axis from the colors below the x-axis. I can think
> > of some relatively inelegant ways of doing this, splitting my dataset
> > in two, plotting them separately, and them showing the graphs
> > together, but I feel as though there may be a better solution.
> >
> > Help?
> >
> > Thank you,
> >
> > Michael
> >



  • Prev by Date: Re: conditional plotstyles in ListPlot
  • Next by Date: Re: RandomArray from user defined distribution?
  • Previous by thread: Re: conditional plotstyles in ListPlot [additional note]
  • Next by thread: Eigensystem