Re: and color via PlotStyle

Showing 1-26 of 26 messages
Re: and color via PlotStyle Bill Rowe 4/29/11 4:33 AM
On 4/28/11 at 6:34 AM, cy...@comcast.net (Christopher O. Young) wrote:

>As a previous poster showed, Plot is a little inconsistent when it
>comes to mapping colors via PlotStyle.

>Plot[
>{ a x /. {a -> 1}, a x^2 /. {a -> 1}, a x^3 /. {a -> 1}
>},{x, 0, 2},PlotStyle -> {Red, Green, Blue}]

>works OK but

This works as you are expecting only because the argument to
Plot is an explicit list. This is the only case where Plot uses
multiple colors.

>Plot[{ a x, a x^2, a x^3}/. {a -> 1},{x, 0, 2},
>PlotStyle -> {Red, Green, Blue}]

>just produces blue plots.

Exactly as it should. Plot always evaluates its arguments by
first substituting a numeric value for the independent variable
and only after that is the expression evaluated. The consequence
it for the argument above, Plot does not see a list of
expressions. Instead it sees a list of numeric values which is
treated as a single function with multiple values and
consequently plotted in a single color.

You can force evaluation of the expression before a numeric
value is substituted for the plot variable by using Evaluate.
That is doing

Plot[Evaluate[{ a x, a x^2, a x^3}/. {a -> 1}],{x, 0, 2}]

will result in Plot seeing an explicit list of expressions which
will get plotted in different colors.

There is no inconsistency in the behavior of Plot. The behavior
I am describing is well documented even if not always well understood.


Re: and color via PlotStyle AES 4/30/11 2:51 AM
In article <ipe7mj$r1o$1...@smc.vnet.net>,
 Bill Rowe <read...@sbcglobal.net> wrote:

>
> >Plot[{ a x, a x^2, a x^3}/. {a -> 1},{x, 0, 2},
> >PlotStyle -> {Red, Green, Blue}]
>
> >just produces blue plots.
>
> Exactly as it should.

The statement "Exactly as it _should_" is open to discussion here.

Consider an "ordinary user" (a user attempting to use Mathematica to do
some simple but useful task) who is at a level of sophistication where
he/she understands the Plot command; how to use it to plot a List of
functions {f1,f2,f3}; the use of simple PlotStyles; and the use of the
"\." syntax 限 but has never had to encounter the concepts of Hold or
Evaluate.  

After all, having a rudimentary understanding of Plot, PlotStyle, the \.
syntax, and lists (which are all relatively simple, understandable,
learnable commands that do familiar things) permits this user to do many
useful tasks 限 and to do themwithout ever having any interaction with
the much more complex and arcane (and much less standard or familiar in
ordinary life) concepts of Hold and Evaluate.

This mythical user might then well be forgiven for thinking that the two
commands

   a = 1;
   Plot[{ a x, a x^2, a x^3}, {x, 0, 2},


   PlotStyle -> {Red, Green, Blue}]

   Plot[{ a x, a x^2, a x^3}/. {a -> 1}, {x, 0, 2},
   PlotStyle -> {Red, Green, Blue}]

_should_ do exactly the same thing, except that the first form will also
obviously leave a assigned the value 1 in subsequent cells.

But of course, this is not what happens, and so the user who uses the
second form (perhaps doing so for compactness, or perhaps wanting to
make a test Plot of their List without setting a to a fixed value)
encounters another of the copious supply of puzzling Mathematica
"gotchas".

I'm not arguing that this outcome is in some sense "wrong", or in any
way a bug.  There may be -- probably are -- deep reasons, buried deep in
the logic and design of Mathematica, as to why Plot has to function in
this way (or maybe an unnecessary design decision was made that Plot
would function in this way to simplify other aspects of Mathematica
programming?).

But it's still unfortunate that it does operate this way.  Would you
(and maybe Helen ??? in Washington) really want to argue that high
school students, or freshman students in college, should have to first
go through a tutorial in Hold and Evaluate (and maybe also HoldAll,
HoldFirst, NHoldAll, HoldAllComplete, HoldRest, SequenceHold, Extract,
and Unevaluated) before they could start plotting Lists using Plot?

Re: and color via PlotStyle Alan 5/1/11 3:22 AM
On Friday, April 29, 2011 7:33:39 AM UTC-4, Bill Rowe wrote:
> [version 1] works as you are expecting only because the argument to

> Plot is an explicit list. This is the only case where Plot uses
> multiple colors.

(Warning: Mathematica novice ahead.)

I do not understand this statement.  Do you mean the key is
that Plot sees a head of List rather than of ReplaceAll?
But as a novice I want to know, why does Plot see the ReplaceAll?
What is the rule that determines whether or not a command will
evaluate its argument before acting on it?

> Plot always evaluates its arguments by
> first substituting a numeric value for the independent variable
> and only after that is the expression evaluated. The consequence
> it for the argument above, Plot does not see a list of
> expressions. Instead it sees a list of numeric values which is
> treated as a single function with multiple values and
> consequently plotted in a single color.

Can you please restate that.  I'm finding it opaque.
(Also, is there no way to assign multiple colors to
a mutiple valued function?)


> There is no inconsistency in the behavior of Plot. The behavior
> I am describing is well documented even if not always well understood.

Can you please point to the documentation you have in mind here.
Thanks!

Alan Isaac

Re: and color via PlotStyle Helen Read 5/1/11 3:22 AM
On 4/30/2011 5:51 AM, AES wrote:
> In article<ipe7mj$r1o$1...@smc.vnet.net>,
>   Bill Rowe<read...@sbcglobal.net>  wrote:
>
>>
>>> Plot[{ a x, a x^2, a x^3}/. {a ->  1},{x, 0, 2},
>>> PlotStyle ->  {Red, Green, Blue}]
>>
>>> just produces blue plots.
>>
>> Exactly as it should.
>
> The statement "Exactly as it _should_" is open to discussion here.
>
> Consider an "ordinary user" (a user attempting to use Mathematica to do
> some simple but useful task) who is at a level of sophistication where
> he/she understands the Plot command; how to use it to plot a List of
> functions {f1,f2,f3}; the use of simple PlotStyles; and the use of the
> "\." syntax =AD=AD but has never had to encounter the concepts of Hold or
> Evaluate.
>
> After all, having a rudimentary understanding of Plot, PlotStyle, the \=2E

> syntax, and lists (which are all relatively simple, understandable,
> learnable commands that do familiar things) permits this user to do many
> useful tasks =AD=AD and to do themwithout ever having any interaction with

Oh, please. Nobody needs to go through all that "before they could start
plotting Lists using  Plot".

My beginning students plot lists all the time. Normally they do it by
defining functions first, for whatever it is they are plotting.

f[x_]:=x
g[x_]:=x^2
h[x_]:=x^3

Plot[{f[x],g[x],h[x]},{x,0,2},PlotStyle -> {Red, Green, Blue}]

(Although actually, most of them accept the default colors and rarely
bother with PlotStyle. Either way, they will get a nice plot with each
curve a different color.)
Then they might go back and edit f[x], g[x], and h[x] to make them 2x,
2x^2, 2x^3, or what have you, and re-evaluate. A little later on (when
not exactly a newbie anymore), they might try something along these
lines, which also produces different colored curves.


Manipulate[
  Plot[{a x, a x^2, a x^3}, {x, -2, 2},
   PlotStyle -> {Red, Green, Blue}, PlotRange -> {-10, 10}], {a, -5, 5,
    1, Appearance -> "Labeled"}]


I have *never* seen a beginner try to use anything remotely like
{ a x, a x^2, a x^3}/. {a ->  1} inside a Plot. But if they did, it
would not bother anybody. They would either ask why it came out that
way, or try a different way of doing it, or ignore it and move on. It's
just not a big deal.

But I don't even show them the /. notation until there is a real need
for it. I teach them about defining functions from day one.


--
Helen Read
University of Vermont


Re: and color via PlotStyle Bill Rowe 5/1/11 3:20 AM
On 4/30/11 at 5:51 AM, sie...@stanford.edu (AES) wrote:

>In article <ipe7mj$r1o$1...@smc.vnet.net>,
>Bill Rowe <read...@sbcglobal.net> wrote:

>>>Plot[{ a x, a x^2, a x^3}/. {a -> 1},{x, 0, 2}, PlotStyle -> {Red,
>>>Green, Blue}]

>>>just produces blue plots.

>>Exactly as it should.

>The statement "Exactly as it _should_" is open to discussion here.

Perhaps, I should have written "Exactly as it should according
to the documentation". If "should" is taken to mean agreement
with some user expectations, then yes, should is open to
discussion/interpretation. And to extent that discussion cannot
change Mathematica as it is, it is pointless to say Mathematica
"should" be different than it is.

As for your comments I snipped, yes, a basic understanding
sufficient to get Plot to do something useful isn't adequate to
explain why

Plot[{ a x, a x^2, a x^3}/. {a -> 1}...

produces a plot with a single color yet

Plot[{x, x^2, x^3}}...

produces a plot with three colors. But so what?

Mathematica is a very powerful toolset containing many useful
tools. And many of those tools have a variety of subtle settings
that can be changed to achieve the desired result. To get best
results from any set of tools, you have to take the time to
fully understand the tools you are using. That takes time. And
there is no other viable alternative.

The behavior of Plot is well documented. And this particular
behavior exists for good reasons.


Re: and color via PlotStyle Dushan Mitrovich 5/2/11 3:51 AM
Helen Read wrote:

> On 4/30/2011 5:51 AM, AES wrote:
>    
>> In article<ipe7mj$r1o$1...@smc.vnet.net>,
>>    Bill Rowe<read...@sbcglobal.net>   wrote:
>>
>>      
>>>        
>>>> Plot[{ a x, a x^2, a x^3}/. {a ->   1},{x, 0, 2},
>>>> PlotStyle ->   {Red, Green, Blue}]
>>>>          
>>>        
>>>> just produces blue plots.
>>>>          
>>> Exactly as it should.
>>>        
>> The statement "Exactly as it _should_" is open to discussion here.
>>
>> Consider an "ordinary user" (a user attempting to use Mathematica to do
>> some simple but useful task) who is at a level of sophistication where
>> he/she understands the Plot command; how to use it to plot a List of
>> functions {f1,f2,f3}; the use of simple PlotStyles; and the use of the
>> "\." syntax =AD=AD but has never had to encounter the concepts of Hold or
>> Evaluate.
>>
>> After all, having a rudimentary understanding of Plot, PlotStyle, the \=2E
>> syntax, and lists (which are all relatively simple, understandable,
>> learnable commands that do familiar things) permits this user to do many
>> useful tasks =AD=AD and to do themwithout ever having any interaction with
>> the much more complex and arcane (and much less standard or familiar in
>> ordinary life) concepts of Hold and Evaluate.
>>
>> This mythical user might then well be forgiven for thinking that the two
>> commands
>>
>>      a = 1;
>>      Plot[{ a x, a x^2, a x^3}, {x, 0, 2},

>>      PlotStyle ->   {Red, Green, Blue}]
>>
>>      Plot[{ a x, a x^2, a x^3}/. {a ->   1}, {x, 0, 2},
>>      PlotStyle ->   {Red, Green, Blue}]
>>

So far everybody has been talking about whether the behavior is reasonable
or unreasonable to expect, but nobody has (AFAIK) done the obvious, namely
stated the solution to the question: Just how does one get
differently-colored curves when using the '/.{a->1}'?

I am a near-beginner, have run into the problem myself, and have been reading
the thread hoping to learn the solution.  No luck.

- Dushan


Re: and color via PlotStyle DrMajorBob 5/2/11 3:51 AM
> But as a novice I want to know, why does Plot see the ReplaceAll?

That's because of:

Attributes@Plot

{HoldAll, Protected}

Because of the HoldAll attribute, Plot starts work with ALL its arguments  
unevaluated.

That is useful, of course, if the plot function cannot be evaluated with  
symbolic arguments.

Bobby


--
DrMaj...@yahoo.com

Re: and color via PlotStyle DrMajorBob 5/3/11 2:45 AM
> ... but nobody has (AFAIK) done the obvious, namely

> stated the solution to the question: Just how does one get
> differently-colored curves when using the '/.{a->1}'?

On the contrary, I've answered that question on this thread, and so have  
several others.

We've also answered it on a hundred other threads.

But here it is again:

Plot[{ a x, a x^2, a x^3} /. {a -> 1} // Evaluate, {x, 0, 2},


  PlotStyle -> {Red, Green, Blue}]

or this:

list = { a x, a x^2, a x^3} /. {a -> 1};
Plot[list, {x, 0, 2},


  PlotStyle -> {Red, Green, Blue}]

Also, you can look up PlotStyle in Help, and gaze in wonder at THE VERY  
FIRST EXAMPLE.

Plot[Evaluate@Table[BesselJ[n, x], {n, 3}], {x, 0, 15}]

Now try it without Evaluate, and see what happens:

Plot[Table[BesselJ[n, x], {n, 3}], {x, 0, 15}]

Bobby

On Mon, 02 May 2011 05:50:57 -0500, Dushan Mitrovich <dus...@spinn.net>  
wrote:


--
DrMaj...@yahoo.com

Re: and color via PlotStyle Murray Eisenberg 5/3/11 2:45 AM
Wrap the argument to Plot with Evaluate.

--
Murray Eisenberg                     mur...@math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower      phone 413 549-1020 (H)
University of Massachusetts                413 545-2859 (W)
710 North Pleasant Street            fax   413 545-1801
Amherst, MA 01003-9305

Re: and color via PlotStyle Bill Rowe 5/3/11 2:47 AM
On 5/2/11 at 6:50 AM, dus...@spinn.net (Dushan Mitrovich) wrote:

>So far everybody has been talking about whether the behavior is
>reasonable or unreasonable to expect, but nobody has (AFAIK) done
>the obvious, namely stated the solution to the question: Just how
>does one get differently-colored curves when using the '/.{a->1}'?

This was answered earlier in the thread. Specifically

Plot[{a x, a x^2}/.a->1,{x,0,1}]

will plot in one color. And

Plot[Evaluate[{a x, a x^2}/.a->1],{x,0,1}]

will plot in two colors


Re: and color via PlotStyle Dushan Mitrovich 5/4/11 3:32 AM
DrMajorBob wrote:
>> ... but nobody has (AFAIK) done the obvious, namely

>> stated the solution to the question: Just how does one get
>> differently-colored curves when using the '/.{a->1}'?
>
> On the contrary, I've answered that question on this thread, and so
> have several others.

Yes, so I've learned.  Somehow I missed its previous mention in this thread.

> We've also answered it on a hundred other threads.
>
> But here it is again:
>
> Plot[{ a x, a x^2, a x^3} /. {a -> 1} // Evaluate, {x, 0, 2},

>  PlotStyle -> {Red, Green, Blue}]
>
> or this:
>
> list = { a x, a x^2, a x^3} /. {a -> 1};
> Plot[list, {x, 0, 2},

>  PlotStyle -> {Red, Green, Blue}]
>
> Also, you can look up PlotStyle in Help, and gaze in wonder at THE
> VERY FIRST EXAMPLE.
>
> Plot[Evaluate@Table[BesselJ[n, x], {n, 3}], {x, 0, 15}]
>
> Now try it without Evaluate, and see what happens:
>
> Plot[Table[BesselJ[n, x], {n, 3}], {x, 0, 15}]
>
> Bobby

Thanks for the info.  I'll do more checking before inquiring next time.

- Dushan


Re: and color via PlotStyle AES 5/4/11 4:49 PM
> DrMajorBob wrote:

> > On the contrary, I've answered that question on this thread, and so
> > have several others.

> > We've also answered it on a hundred other threads.

And does that very fact not tell us all something . . . ?

Re: and color via PlotStyle DrMajorBob 5/5/11 2:25 AM
It tells something to those of us who read it... and who else could it  
tell anything?

Bobby


--
DrMaj...@yahoo.com

Re: and color via PlotStyle Dushan Mitrovich 5/6/11 4:21 AM
AES wrote:
>> DrMajorBob wrote:
>>      
>>> On the contrary, I've answered that question on this thread, and so
>>> have several others.
>>>        
>>> We've also answered it on a hundred other threads.
>>>        
> And does that very fact not tell us all something . . . ?
>    

Yes, and I've acknowledged it.

- Dushan


Re: and color via PlotStyle AES 5/6/11 4:24 AM
> >> > We've also answered it on a hundred other threads.

> > And does that very fact not tell us all something . . . ?

> It tells something to those of us who read it... and who else could it  
> tell anything?

Well, to spell out what that "something" is:  When a question like this,
concerned with one of the simplest, most elementary, most useful, and
widely used functions in Mathematica, gets raised online (and then has
to be answered)  _hundreds_ of times, that clearly indicates a "product
defect" in the design of that function, or its documentation, or both.

Re: and color via PlotStyle DrMajorBob 5/7/11 4:31 AM
As I said before, the very first example in Help for PlotStyle shows the  
solution.

Bobby


--
DrMaj...@yahoo.com

Re: and color via PlotStyle Dushan Mitrovich 5/7/11 4:32 AM

Thanks for the disambiguation.  Yes, I second that conclusion.

- Dushan

Re: and color via PlotStyle DrMajorBob 5/7/11 3:22 AM
It tells something to those of us who read it... and who else could it  
tell anything?

Bobby

On Wed, 04 May 2011 18:49:24 -0500, AES <sie...@stanford.edu> wrote:

>> DrMajorBob wrote:
>
>> > On the contrary, I've answered that question on this thread, and so
>> > have several others.
>
>> > We've also answered it on a hundred other threads.
>
> And does that very fact not tell us all something . . . ?
>


--
DrMaj...@yahoo.com

Re: and color via PlotStyle JUN 5/9/11 11:47 PM
On May 7, 3:22 am, DrMajorBob <btre...@austin.rr.com> wrote:
> It tells something to those of us who read it... and who else could it
> tell anything?
>
> Bobby
>
> On Wed, 04 May 2011 18:49:24 -0500, AES <sieg...@stanford.edu> wrote:
> >> DrMajorBob wrote:
>
> >> > On the contrary, I've answered that question on this thread, and so
> >> > have several others.
>
> >> > We've also answered it on a hundred other threads.
>
> > And does that very fact not tell us all something . . . ?
>
> --
> DrMajor...@yahoo.com

First a practical comment to the original poster: let's assume for
some reason you have the "unexpected" outcome of three curves with the
same color as in
Plot[{x, x^2, x^3} /. { }, {x, 0, 2}, PlotStyle -> {Red, Green, Blue}]
Then you can still change the style of each curve individually by
using the editor tools (click the plot, press Ctrl-t, then double-
click into the plot until you have highlighted the desired curve; at
that point you can change the color using the Stroke tool panel).

I don't want to sound too philosophical, but there seems to be a
problem in drawing the line between Mathematica's internal logical
consistency and the requirements of the user interface. In my opinion,
Plot is part of the user interface, and this should give the designers
of the function the freedom to make it friendlier to human users even
if that comes at the price of departing (in a very harmless way) from
language-specific dogmas.

It's easy to forget to put the Evaluate around lists in Plot, and this
has nothing at all to do with understanding Mathematica, as an
apologist would claim. Its just a user interface issue. Nobody would
get hurt if Plot were allowed to be a little more intelligent by
recognizing that when three curves are ultimately drawn they should by
allowed to be styled individually using the familiar options (as they
already are using the Drawing Tools). Comparing Plot and ListPlot, the
presence or absence of HoldAll is an internal necessity, but it
doesn't follow from this that the effect of PlotStyle -> {Red, Green,
Blue} should be different between the two (which it is).

Jens

Re: and color via PlotStyle DrMajorBob 5/11/11 1:26 AM
Agreed, Jens. There's no reason PlotStyles has to be locked in stone  
before the number of curves is determined.

They can be added afterward, and Plot could certainly be made just a  
little smarter, in order to do that.

Bobby


--
DrMaj...@yahoo.com

Re: and color via PlotStyle Bill Rowe 5/11/11 1:27 AM
On 5/10/11 at 2:48 AM, noe...@gmail.com (JUN) wrote:

>I don't want to sound too philosophical, but there seems to be a
>problem in drawing the line between Mathematica's internal logical
>consistency and the requirements of the user interface. In my
>opinion, Plot is part of the user interface, and this should give
>the designers of the function the freedom to make it friendlier to
>human users even if that comes at the price of departing (in a very
>harmless way) from language-specific dogmas.

The problem is one of implementation. Consider:

A user who wants to plot the solution space for 0 == x^2-a for
different values of a likely would want that plot to show a
single color. One way to generate that plot would be:

Plot[Sqrt[x] {-1, 1}, {x, 0, 5}]

Here, the argument to Plot is an expression that returns a list
of numeric values for each numeric value substituted for x. The
key question is how is Mathematica to determine when to see this
as a multivalued function consistent with this example or as a n
different functions?

Currently, that is resolved by deciding any explicit list given
to Plot is a list of n curves and anything not explicitly a list
is a single multivalued function to be plotted in a single
color. The rule could be made different. But that would simply
lead to different confusion and possibly greater difficulty when
creating some plots. Ultimately, anything other than a
pre-specified rule requires some sort of mind reading to divine
the users intent, clearly not possible.

Re: and color via PlotStyle DrMajorBob 5/12/11 1:32 AM
At the end of it all, Plot has created a Line object for each curve.  
(Sometimes more than one Line object for the same curve, but grouped  
together by curve.)

There's no reason styles could not be added AFTER the Line objects are  
created. Yes, of course that means "greater difficulty when creating some  
plots".... but nothing a slightly smarter Plot could not handle.

Bobby

On Wed, 11 May 2011 03:27:55 -0500, Bill Rowe <read...@sbcglobal.net>  
wrote:


--
DrMaj...@yahoo.com

Re: and color via PlotStyle Bill Rowe 5/12/11 1:35 AM
On 5/11/11 at 11:13 AM, btr...@austin.rr.com (DrMajorBob) wrote:

>At the end of it all, Plot has created a Line object for each curve.
>(Sometimes more than one Line object for the same curve, but grouped
>together by curve.)

>There's no reason styles could not be added AFTER the Line objects
>are created. Yes, of course that means "greater difficulty when
>creating some plots".... but nothing a slightly smarter Plot could
>not handle.

I don't disagree with your observation that styles could be
added after the curves are created. But I don't see how this
solves anything. Whether styles are set before the curves are
created or after, there has to be a decision made as to whether
multiple curves represent distinct functions to have distinct
styles by default or multiple branches of one function to be
plotted all in the same style.

One can envision a number of different ways to set the defaults.
But no matter how they are set, there will always be someone who
would like the defaults set differently. And no matter how they
are set, a newer user will get surprised when he tries to plot
something with a different intent that runs afoul of the pre-set defaults.

To me, rendering styles after the curves are drawn simply moves
the problem around without really changing anything.

Or perhaps you are suggesting doing away with defaults
altogether and having a user apply styles after the entire
graphic is drawn? That would certainly avoid the issue of
attempting to devine user intent. But it seems to me this would
also make Plot more time consuming to use.


Re: and color via PlotStyle JUN 5/12/11 1:32 AM
On May 11, 1:27 am, Bill Rowe <readn...@sbcglobal.net> wrote:

> On 5/10/11 at 2:48 AM, noec...@gmail.com (JUN) wrote:
>
> >I don't want to sound too philosophical, but there seems to be a
> >problem in drawing the line between Mathematica's internal logical
> >consistency and the requirements of the user interface. In my
> >opinion, Plot is part of the user interface, and this should give
> >the designers of the function the freedom to make it friendlier to
> >human users even if that comes at the price of departing (in a very
> >harmless way) from language-specific dogmas.
>
> The problem is one of implementation. Consider:
>
> A user who wants to plot the solution space for 0 == x^2-a for
> different values of a likely would want that plot to show a
> single color.

If the user specifies a plot style LIST, they obviously (!) don't want
what you're claiming.

Jens

Re: and color via PlotStyle Bill Rowe 5/13/11 3:28 AM
On 5/12/11 at 9:27 AM, btr...@austin.rr.com (DrMajorBob) wrote:

>>there has to be a decision made as to whether multiple curves
>>represent distinct functions to have distinct styles by default or
>>multiple branches of one function to be plotted all in the same
>>style.

>Already true, and the current solution is to use Evaluate... which
>cannot work if the plot function involves Part, NIntegrate, or
>anything else that can't be evaluated while the argument is symbolic.

You are quite correct that you cannot do something like

Plot[NIntegrate[{expr1,expr2,expr},{x,a,
100}]//Evaluate,{a,0,10}] and get multiple styles.

But I doubt for something like this, the issue of a single style
vs multiple styles would arise. If the unless the expressions
are pretty simple, the execution time for this Plot will be
terrible. And if the expressions are fairly simple, then it
should be possible to do

Plot[Integrate[{expr1,expr2,expr},{x,a,
100}]//Evaluate,{a,0,10}] which would allow multiple styles.

Unless you have a very fast machine or a lot of patience, doing

Plot[NIntegrate[... isn't a good way to do things for
non-trivial integrals. Execution time is going to be a far
bigger problem than multiple styles.


Re: and color via PlotStyle DrMajorBob 5/13/11 3:29 AM
> there has to be a decision made as to whether
> multiple curves represent distinct functions to have distinct
> styles by default or multiple branches of one function to be
> plotted all in the same style.

Already true, and the current solution is to use Evaluate... which cannot  
work if the plot function involves Part, NIntegrate, or anything else that  
can't be evaluated while the argument is symbolic.

Bobby

On Thu, 12 May 2011 03:35:18 -0500, Bill Rowe <read...@sbcglobal.net>  
wrote:

> On 5/11/11 at 11:13 AM, btr...@austin.rr.com (DrMajorBob) wrote:
>
>> At the end of it all, Plot has created a Line object for each curve.
>> (Sometimes more than one Line object for the same curve, but grouped
>> together by curve.)
>
>> There's no reason styles could not be added AFTER the Line objects
>> are created. Yes, of course that means "greater difficulty when
>> creating some plots".... but nothing a slightly smarter Plot could
>> not handle.
>
> I don't disagree with your observation that styles could be
> added after the curves are created. But I don't see how this
> solves anything. Whether styles are set before the curves are
> created or after, there has to be a decision made as to whether
> multiple curves represent distinct functions to have distinct
> styles by default or multiple branches of one function to be
> plotted all in the same style.
>
> One can envision a number of different ways to set the defaults.
> But no matter how they are set, there will always be someone who
> would like the defaults set differently. And no matter how they
> are set, a newer user will get surprised when he tries to plot
> something with a different intent that runs afoul of the pre-set  
> defaults.
>
> To me, rendering styles after the curves are drawn simply moves
> the problem around without really changing anything.
>
> Or perhaps you are suggesting doing away with defaults
> altogether and having a user apply styles after the entire
> graphic is drawn? That would certainly avoid the issue of
> attempting to devine user intent. But it seems to me this would
> also make Plot more time consuming to use.
>
>


--
DrMaj...@yahoo.com

More topics »