MathGroup Archive 2005

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

Search the Archive

Re: Missing Graphics

  • To: mathgroup at
  • Subject: [mg54315] Re: [mg54248] Missing Graphics
  • From: "Wolf, Hartmut" <Hartmut.Wolf at>
  • Date: Thu, 17 Feb 2005 10:30:37 -0500 (EST)
  • Sender: owner-wri-mathgroup at

>-----Original Message-----
>From: Andrzej Kozlowski [mailto:akoz at] 
To: mathgroup at
>Sent: Thursday, February 17, 2005 12:24 AM
>To: Wolf, Hartmut
>Cc: mathgroup at
>Subject: [mg54315] Re: 
>On 16 Feb 2005, at 20:35, Wolf, Hartmut wrote:
>>> -----Original Message-----
>>> From: Bruce Colletti [mailto:vze269bv at]
To: mathgroup at
>> To: mathgroup at
>>> Sent: Tuesday, February 15, 2005 3:51 AM
>>> To: mathgroup at
>>> Subject: [mg54315] [mg54279] [mg54248] Missing Graphics
>>> Re Mathematica 5.1.
>>> This code displays (as intended) five versions of g (first two are 
>>> same):
>>> g = Plot3D[Sin@x Cos@y, {x, -PI, PI}, {y, -PI, PI}];
>>> Scan[Show@#@g &, {SurfaceGraphics, Graphics, ContourGraphics,
>>>    DensityGraphics}];
>>> However, when DisplayFunction->Identity is added to Plot3D, 
>only the 
>>> SurfaceGraphics plot appears.  Why don't the others?
>>> Thankx.
>>> Bruce
>> Bruce,
>> it's not the SurfaceGraphics which appears -- that would be queer -- 
>> yet the Graphics, which is ok, see:
>> In[10]:= Options[#[g], DisplayFunction] & /@
>>   {SurfaceGraphics, Graphics, ContourGraphics, DensityGraphics}
>> From In[10]:=
>> Options::"optnf": DisplayFunction is not a known option for -
Graphics -
>> Out[10]=
>> {{DisplayFunction -> Identity}, {}, {DisplayFunction -> Identity}, 
>> {DisplayFunction -> Identity}}
>> As DisplayFunction is no option for Graphics it cannot be retained;
>> fact no option of g is retained. If you look at
>> In[13]:= Options[g]
>> you'll indeed note that none of those would make sense after the 
>> conversion of g to a 2D object.
>> --
>> Hartmut Wolf
>Hartmut is as usual right but the way the explanation is 
>expressed is confusing. DisplayFunction is certainly an option 
>for Graphics and
>Options[Plot[x^2, {x, -1, 1}], DisplayFunction]
>{DisplayFunction :> $DisplayFunction}
>but not for Graphics objects that result by converting 
>Graphics3D or SurfaceGraphics objects:
>Options[Graphics[Plot3D[x^2 + y^2, {x, -1, 1},
>     {y, -1, 1}]], DisplayFunction]
>  DisplayFunction is not a known option for Graphics
>As stated literally this message actually looks false!
>Andrzej Kozlowski
>Chiba, Japan

Yes, Andrzej,

Graphics here appears as a chimaera: it is 

an inert _container_ for (structures of) 2D graphical primitives as
Point, Line etc. to be displayed by Show and (optionally) including
certain options associated with the object, which wait to be interpreted
by Show (as well as the primitives do). As 


tells, there are even defaults, which however, are not passed to the
graphical objects, but wait for interpretation at Show (if not supplied
with the object):

In[8]:= l2D = Graphics[Line[{{0, 0}, {1, 1}}]]
Out[8]= - Graphics -

In[10]:= Options[l2D]
Out[10]= {}

In[18]:= Show[l2D]
Out[18]= - Graphics -

just draws the line.  If we reset a default, e.g.

SetOptions[Graphics, Background -> Hue[1/6, .5, 1]]

and then draw

In[22]:= Show[l2D]
Out[22]= - Graphics -

the same object now is drawn in front of a yellow background.

If we put specific options into the Graphics container these will be

In[27]:= Show[l2D0 = Append[l2D, Background -> Automatic]]
Out[27]= - Graphics -

In[28]:= Options[l2D0]
Out[28]= {Background -> Automatic}

This however is not an Option associated with the symbol l2D0, but just
read from its container.

In[25]:= SetOptions[Unevaluated[l2D], Background -> Automatic]
>From In[25]:=
SetOptions::"optnf": Background is not a known option for l2D.

Deplorably the options for Graphics do not work as a filter in a similar
sense, it is possible to put nonsensical options into the container
waiting to be spotted by Show:

In[16]:= Graphics[Line[{{0, 0}, {1, 1}}], WorkingPrecision -> 16]
Out[16]= - Graphics -

In[17]:= % // Show
>From In[17]:=
Graphics::"optx": Unknown option WorkingPrecision in - Graphics -

At the other side Graphics is a _function_ to convert 3D graphical
objects to a 2D object, whose primitives are now enclosed in the
_container_ graphics -- of course.

As I had stated, the usual options associated with a 3D graphics object
are not to be retained, so it obviously was the choice of WRI not to
keep any of them when converting.  I tend to defend this.

Interestingly, with

In[36]:= Show[Append[Graphics[g], Options[g]]]
Out[36]= - Graphics -

DisplayFunction -> Identity becomes effective, and no error occurs, but
when trying

In[37]:= Show[Append[Graphics[g], Options[g]], DisplayFunction ->
>From In[37]:=
Graphics::"optx": Unknown option ViewPoint in - Graphics -

Show bails out at the first nonsensical option it encounters.

The whole scheme seems to be quite reasonable, in particular not to
associate defaults to Show but to the symbols that constitute the
containers (or say "data types") for the graphical objects.  Thus you
may invent your own graphical types and extend Show to display them.

Definitely my first explanation as stated is wrong and void; we just
observe the fact that the option DisplayFunction (as any option) is not
retained with the conversion.  The error message refers to the converted
object -- expressed as container Graphics -- and does not refer to the
symbol Graphics!

Thanks, Andrzej!


  • Prev by Date: Re: Re: Re: Bug Report - Two numerical values for a same variable
  • Next by Date: graphing in Mathematica
  • Previous by thread: Re: Re: Re: Missing Graphics
  • Next by thread: "teach" mathematica an integral