Re: What's going on here (Table-generated lists)?
- To: mathgroup at smc.vnet.net
- Subject: [mg98092] Re: What's going on here (Table-generated lists)?
- From: Albert Retey <awnl at gmx-topmail.de>
- Date: Mon, 30 Mar 2009 04:41:38 -0500 (EST)
- References: <gqfl2e$ksp$1@smc.vnet.net> <gqiaag$op5$1@smc.vnet.net> <gqkuvv$4bt$1@smc.vnet.net>
Erik Max Francis wrote: Hi, > Thanks to you and everyone who responded. I do understand the HoldAll > attribute and why Plot is doing what it's doing. > > I fully understand why the HoldAll attribute is generally useful and why > it's used here, but I still don't see why it doesn't make sense for Plot > to recognize a list as an actual list and plot each with a different > color. Shouldn't it be manually evaluating its argument, then plotting > with different colors if it ends up with a list? > > Is there any particular situation where you'd want the current behavior > -- not the HoldAll, but rather the plotting what ends up being a list of > functions with the same color? I think it is a general problem: how many colors would you expect for this: Plot[Table[x^n, {n, 0, Floor[x]}], {x, 1, 10}, PlotRange -> All] or for this: f[x_] := (Pause[120]; Exp[x]) f[x_?NumericQ] := {Exp[x], Log[x]} Plot[f[x], {x, 0, 1}] Of course Plot could be programmed so that it detects more unambiguous cases and not only explicit Lists, but it also need to be reasonably fast, so there always is a limit on what it can handle "as intended". I think the current behaviour is not too bad and there is a very simple workaround with which you can control exactly what it will do... albert