Mathematica 9 is now available
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: PlotStyle in version 6

  • To: mathgroup at smc.vnet.net
  • Subject: [mg80475] Re: PlotStyle in version 6
  • From: Szabolcs <szhorvat at gmail.com>
  • Date: Thu, 23 Aug 2007 01:09:38 -0400 (EDT)
  • Organization: University of Bergen
  • References: <fagu9d$95o$1@smc.vnet.net>

ben wrote:
> Dear all,
> 
> Could you please help me pointing out,
> why the following line of code
> produces to curves of the same plotstyle ?
> 
> Plot[{t, 1 + t} /. vals, {t, 0, 10},
>  PlotStyle -> {{Red, Dashed}, {Blue}}]
> 
> Cheers
> Ben

Using an expression that evaluates to a list (and not a single number) 
as the first argument of Plot[] is a new convenience feature in 
Mathematica 6.  Mathematica 5 would give an error message saying that 
{t, 1 + t} /. vals does not evaluate to a number.

The drawback of this new feature is that is not possible to determine 
the length of the list before the expression is evaluated.  In your 
example Mathematica thinks that there is only one curve to be plotted (you used 
a single expression and not a list as Plot's argument), so it uses a 
single style.

You should use the following command:

Plot[{t, 1 + t} /. vals // Evaluate, {t, 0, 10},
      PlotStyle -> {{Red, Dashed}, {Blue}}]

Szabolcs

PS: Please give complete examples that can be evaluated without errors 
in a new kernel session.  You did not specify the value of 'vals'.


  • Prev by Date: Re: Re: spurious $Aborted messages. How to track
  • Next by Date: Re: On partitioning lists by intervals
  • Previous by thread: Re: PlotStyle in version 6
  • Next by thread: Outer with index in bounds