Graphic bug in Mathematica

*To*: mathgroup at smc.vnet.net*Subject*: [mg13355] Graphic bug in Mathematica*From*: Andrzej Kozlowski <andrzej at tuins.ac.jp>*Date*: Mon, 20 Jul 1998 02:50:10 -0400*Sender*: owner-wri-mathgroup at wolfram.com

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

**pasting the outputs**

**Re: Up N' Down values.**

**Re: pasting the outputs**

**Re: Graphic bug in Mathematica**