RE: Graphic bug in Mathematica

• To: mathgroup at smc.vnet.net
• Subject: [mg13411] RE: [mg13355] Graphic bug in Mathematica
• From: Ersek_Ted%PAX1A at mr.nawcad.navy.mil
• Date: Thu, 23 Jul 1998 03:32:56 -0400
• Sender: owner-wri-mathgroup at wolfram.com

```Furthermore,
As far as I can tell it is not possible to get a graphic of a Point on
top  of a dashing Line.
See the example below.

In[1]:=
box1=Rectangle[{-1.22, 2.41}, {-0.92, 2.27}]; box2=Rectangle[{0.094,
2.85}, {0.37, 2.69}]; pnt1={PointSize[0.12],Point[{-1.05, 2.33}]};
pnt2={PointSize[0.12],Point[{0.24, 2.76}]};
lin1={GrayLevel[0.6],Thickness[0.005],Line[{{-2,2},{1,3}}]};
lin2={GrayLevel[0.6],Thickness[0.005],Dashing[{0.01,0.02}],
Line[{{-2,2},{1,3}}]};

In[2]:=
Show[Graphics[{pnt1, lin1, pnt2}]];

(* Graphics not shown is a gray Line and two points.  *) The gray Line
is drawn over the Point in the lower left. The Point in the upper right
is drawn over the gray Line.

In[3]:=
Show[Graphics[{pnt1, lin2, pnt2}]];

(* Graphics not shown is a gray dashed Line and one Point (not two).  *)
The gray Line is drawn over the Point in the lower left, The second
Point isn't displayed.

Shouldn't the graphic from In[3] look the same as the graphic from In[2]
except for a Dashing Line rather than a solid line?

Ted Ersek

|
|This message concerns a bug in Mathematica involving the graphic
|directive Dashing[] and the primitive Point[]. This is a genuine bug,
|acknowledged as such by wri's Technical Support. I learned about it
|from Gianluca Gorni (<gorni at dimi.uniud.it>) who informed Technical
|Support. However, since we found their reply and the remedy proposed
|not entirely satisfactory we thought it would be a good idea to make
it |more widely known, for reasons that will become apparent later in
this |message.
|
|First of all I would like to point out that the bug involves only
screen |display: printing to a PostScript printer or exporting a
graphic as an |EPS is not affected. The bug has been confirmed on
Macintosh and |Windows platforms and as it involves the kernel rather
than the Front |End it is almost certainly cross platform. |
|The bug is in fact two bugs. The first one is common to both
Mathematica |2 and 3. The second one affects only Mathematica 3. The
second one |seems to me to be the more serious. |
|The bug (bugs) can be summarized like this: Dashing[] before a Point[]
|will kill the point when using Show or Display["stdout",graphic]. Here
|is a simple example:
|
|g1=Graphics[{Dashing[{0.01}],
|Line[{{-1,1},{2,1}}],PointSize[0.1],Point[{0,0}]},PlotRange->All];Show[g1]
|
|If you evaluate it in either Mathematica 2 or 3 you will see that the
|point is not drawn. Putting the Point before Dashing makes the point
|display properly.
|
|In Mathematica 2 there is a better way to solve this problem. Just
|isolate Dashing and Line by list brackets: |
|g2=Graphics[{{Dashing[{0.01}],
|Line[{{-1,1},{2,1}}]},PointSize[0.1],Point[{0,0}]},PlotRange->All];Show[g2]
|
|This works fine in Mathematica 2 but not in Mathematica 3. This is the
|second bug I had in mind, and the more serious one. Why is it more
|serious? Well, the only thing Technical Support could suggest is to be
|careful about the order in which one enters primitives and directives.
|That's perhaps O.K. when you are only using graphics entirely
|constructed by yourself, but what about using graphic packages created
|by others? Consider the most extreme case. Suppose you want to display
|together two graphics, say graphic1 and graphic2 and suppose both of
|them contain both Dashing and Point. Suppose that they come from two
|different graphic packages.
|
|graphic1=Graphics[{{PointSize[0.1],Point[{0,0}]},{Dashing[{0.01}], |
Line[{{-1,-1},{-1,2}}]}}]
|
|graphic2=Graphics[{{PointSize[0.2],Point[{0.5,0.5}]},{Dashing[{0.1}], |
Line[{{-1,1},{2,-1}}]}}]
|
|Note that they both have been written using "correct" ordering.
|Nevertheless you can never display them correctly together. Neither
|Show[{graphic1,graphic2}] nor Show[{graphic2,graphic1}] will produce
|the correct picture. You would have to look at the code of the two
|graphics and re-write it yourself.  Indeed, whenever you are
displaying |together any graphics coming from different packages you
potentially |face this problem.
|
|I have found a very simple (I hope temporary, until the next release of
|Mathematica) remedy. All you need to do is to redefine Point, e.g.: |
|NewPoint[{x_,y_}]:={Dashing[{}],Line[{{x,y},{x,y}}],Point[{x,y}]} |
|Replacing Point by NewPoint in the graphic1 and graphic2 solves the
|above problem. I think this point is worth remembering for any one
|writing a graphic package which makes use of the Point primitive. |
|Andrzej Kozlowski

```

• Prev by Date: Re: Re: How to declare Integers?
• Next by Date: RE: Re: Re: Non-comm
• Previous by thread: Re: Graphic bug in Mathematica
• Next by thread: loop problems