MathGroup Archive 1992

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

Search the Archive

Re: Plotting problems

  • To: mathgroup at
  • Subject: Re: Plotting problems
  • From: Jan Lac Office C115 <janlac at>
  • Date: Wed, 18 Nov 92 11:10:59 +0100

> I have written an Mma program whose last 3 lines are:

> ListPlot[nodePairs,PlotJoined->True,DisplayFunction->Identity]
> Plot[S[x],{x,node[[1]],node[[n+1]]},DisplayFunction->Identity]
> Show[%,%%,DisplayFunction :> $DisplayFunction]

> When the program is executed the Show function will sometimes(rarely)  
> properly overlay the two previous plots but more often, one of the  
> following error messages are displayed with no graph:

> Show::gtype: String is not a type of graphics.
> Show::gtype: Show is not a type of graphics.

The substitution commands '%', '%%', etc. refer to the actual previous lines
as stored in the history log of the current session. That means if you read in
a program then no matter how many lines it contains the line counter system
variable $Line is incremented by one and only the command <<programname
is appended to the internal history log buffer.

Try this: In[k] Plot[Sin[x],{x,-Pi,Pi}, DisplayFunction->Identity]
          In[k+1] Plot[Cos[x],{x,-Pi,Pi}, DisplayFunction->Identity]
	  In[k+2] <<yourprogramname

Remember you have to type this commads in manually!

The solution to your problem:
Modify your file in the following way:

tmp1 =  ListPlot[nodePairs,PlotJoined->True,DisplayFunction->Identity]
tmp2 =  Plot[S[x],{x,node[[1]],node[[n+1]]},DisplayFunction->Identity]
Show[tmp2,tmp1,DisplayFunction :> $DisplayFunction]

As far as I am concerned I would prefer to have all the commands
read in from the external file included in the internal history buffer.
This would allow an easy reference to or editing of the read in commads
without a proliferation of fractions of original command file if one
does not want to edit and run it as a whole again and again. I did not
have a look into this but if somebody did I would appreciate any
suggestions, comments, etc.


Jan Lac

P.S. Because I am not working with notebooks and wanted to have a look
into the history buffer of the current session I made the following
script which is very handy to have in init.m file. You might find it
usefull too when not working with notebooks:

     history[x_,y_] := Do[Print[i,"*> ",InString[i]],{i,x,y}]

>>  Jan Lac, NIKHEF-K, Postbus 41882, NL-1009 DB Amsterdam, The Netherlands <<
>>           e-mail: janlac at    Fax: (31) 20 - 592 2165            <<

  • Prev by Date: Re: CPU time for Solve under v.2.0 and 2.1
  • Next by Date: Re: HypergeometricPFQ
  • Previous by thread: Re: Plotting problems
  • Next by thread: 3D rendering question