Graphics in PlotMarkers buggy in Mathematica 7

248 views
Skip to first unread message

JUN

unread,
Jan 12, 2009, 8:15:47 PM1/12/09
to
Hi,
in Mathematica 7 on Mac OS X, try to execute this simple example:

ListPlot[{{{1, 1}}, {{1, 2}}}, PlotMarkers -> {Graphics[{Hue[0.5],
Circle[]}], Graphics[{Hue[0.96],Circle[]}]}]

Whereas this works in Mathematica 6.03, there is now the error
"An improperly formatted option was encountered while reading a
GraphicsBox. The option was not in the form of a rule."

This is apparently caused by any graphics directive (such as Hue,
Opacity, Thickness), but I was able to reliably work around it by
replacing Graphics with HoldForm@Graphics.

There seems to be no problem with Graphics3D markers, and according to
the documentation there should be no problem with arbitrary Graphics
as plot markers, either. I'm guessing there has been some subtle
change in Graphics' inner workings that conflicts with its use in
PlotMarkers - but who knows.

Anyway, HoldForm is the cure, in case anyone else stumbles over this
issue.

Cheers,
Jens

Syd Geraghty

unread,
Jan 12, 2009, 10:14:58 PM1/12/09
to
Jens,

The workaround you suggested has a problem if the PlotMarker Circle[]
is altered to a different radius.

ListPlot[{{{1, 1}}, {{1, 2}}},

PlotMarkers -> {HoldForm@Graphics[{Hue[0.5], Circle[{1, 1}, 0.01]}],
HoldForm@Graphics[{Hue[0.96], Circle[{1, 2}, 2]}]}]


Does not change the PlotMarker circle radius at all in either case.

This seems like a bug and I have reported it to WRI.


Syd Geraghty B.Sc, M.Sc.

sydge...@mac.com

Mathematica 7.0.0 for Mac OS X x86 (64 - bit) (21st November, 2008)
MacOS X V 10.5.6
MacBook Pro 2.33 GHz Intel Core 2 Duo 2GB RAM

JUN

unread,
Jan 13, 2009, 7:02:51 AM1/13/09
to
On Jan 12, 7:14 pm, Syd Geraghty <sydgerag...@me.com> wrote:
> Jens,
>
> The workaround you suggested has a problem if the PlotMarker Circle[]
> is altered to a different radius.
>
> ListPlot[{{{1, 1}}, {{1, 2}}},
> PlotMarkers -> {HoldForm@Graphics[{Hue[0.5], Circle[{1, 1}, 0.01]}],
> HoldForm@Graphics[{Hue[0.96], Circle[{1, 2}, 2]}]}]
>
> Does not change the PlotMarker circle radius at all in either case.
>
>

Syd,
although your example isn't quite correct, you do have a point!

Your example doesn't work even in Mathematica 6 where the bug is
absent: the documentation says we should be able to set the scale s of
a graphics object g by specifying {g, s} in PlotMarkers. But if I try
this in my example with HoldForm applied to Graphics, it doesn't
work.

What does work, though, is to specify the size s of the circle as
Circle[{0,0}, Scaled[s]]. This works in Mathematica 6 and 7, with or
without HoldForm. For text, you can also put in things like Style
["A",Larger] etc.

I did report the bug, too. A working ListPlot would be nice, wouldn't
it?

Jens


Sjoerd C. de Vries

unread,
Jan 14, 2009, 5:36:36 AM1/14/09
to
Looks like a genuine bug. The part of the graphics code that place the
circles in Mathematica 7 is (using FullForm):

Inset[Graphics[List[Hue[0.5]], Circle[List[0, 0]]], 6]]

whereas in Mathematica 6 it is (looks the same, but it's subtilly different):

Inset[Graphics[List[Hue[0.5], Circle[List[0, 0]]]], 6]]

Clearly, in Mathematica 7 the outmost List does not wrap around all graphics
primitives as it does in Mathematica 6, but only around the first one. The
closing bracket is misplaced. This leaves the latter primitives
bungling.

Cheers -- Sjoerd

Sjoerd C. de Vries

unread,
Jan 14, 2009, 5:36:58 AM1/14/09
to
Another workaround would be placing each marker between curly
brackets. As in:

ListPlot[{{{1, 1}}, {{1, 2}}},
PlotMarkers -> {{Graphics[{Hue[0.5],
Circle[]}]}, {Graphics[{Hue[0.96], Circle[]}]}}]

Cheers -- Sjoerd

On Jan 13, 3:15 am, JUN <noec...@gmail.com> wrote:

JUN

unread,
Jan 15, 2009, 6:09:59 AM1/15/09
to
On Jan 14, 2:36 am, "Sjoerd C. de Vries" <sjoerd.c.devr...@gmail.com>
wrote:

Sjoerd,
thanks for getting to the bottom of this, your workaround really seems
to be fool-proof.

Jens

Reply all
Reply to author
Forward
0 new messages