Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1999
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1999

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

Search the Archive

RE: Follow-Up Question to

  • To: mathgroup at smc.vnet.net
  • Subject: [mg20202] RE: [mg20187] Follow-Up Question to [mg20090]
  • From: "Ersek, Ted R" <ErsekTR at navair.navy.mil>
  • Date: Wed, 6 Oct 1999 21:06:24 -0400
  • Sender: owner-wri-mathgroup at wolfram.com

A. Hanszen  wrote:
---------------------
Adam Smith rose the question, why  nodisp in

nodisp = DisplayFunction -> Identity
graph1 = Plot[Sin[2 Pi x],{x,0,2},nodisp]

does not work. From the answers in this group, we learned,
that one either has to wrap nodisp into Evaluate

graph1 = Plot[Sin[2 Pi x],{x,0,2},Evaluate[nodisp]]

or use Block to temporarily deviate DisplayFunction to Identity
and use Show outside the Block-construct to display the combined
graphs or use one or the other package to combine different graphs.

Plot has the Attribute HoldAll. However, if one changes this
to HoldFirst (which might have other unwanted side effects),
Evaluate around nodisp is still necessary. Can anybody in this
group explain, why? It is just a matter of better understanding
Hold and so on, rather than a question of combining graphics 
objects.

-------------------------
REPLY:

Below Plot makes the graphic of a Sine wave even though t=3.5.

In[1]:=
t=3.5;

In[2]:=
Plot[Sin[t],{t,0,4Pi}];

(* Graphic not shown. *)

-----------------------------
Next I change the attributes as you suggest.

In[3]:=
ClearAttributes[Plot,HoldAll];
SetAttributes[Plot,HoldFirst];


Now we the line below doesn't work.

In[5]:=
Plot[Sin[t],{t,0,4 Pi}];

  Plot::itraw: Raw object 3.5` cannot be used as an iterator.


In this case Plot[Sin[t],{t,0,4 Pi}] 
evaluated to Plot[Sin[t],{3.5,0, 4 Pi}] which is an invalid input.

--------------------

Now try my (PlotFunctions.m) package available from 
http://www.mathsource.com/cgi-bin/msitem?0209-876 .
With this package you never need to use Evaluate inside Plot, and I can
pretty much say it doesn't degrade Plot in any way!

--------------------
Regards,
Ted Ersek

For Mathematica tips, tricks see 
http://www.dot.net.au/~elisha/ersek/Tricks.html


  • Prev by Date: RE: Drawing Rectangular Grid
  • Next by Date: Re: Follow-Up Question to
  • Previous by thread: Follow-Up Question to
  • Next by thread: Re: Follow-Up Question to