Re: Possible bug in Mathematica 7 using ColorFunction
- To: mathgroup at smc.vnet.net
- Subject: [mg101186] Re: [mg101112] Possible bug in Mathematica 7 using ColorFunction
- From: John Fultz <jfultz at wolfram.com>
- Date: Fri, 26 Jun 2009 06:50:18 -0400 (EDT)
- Reply-to: jfultz at wolfram.com
On Wed, 24 Jun 2009 06:33:36 -0400 (EDT), Jeff Lawlis wrote:
> Problem: use of ColorFunction affects spacing of Greek characters in
> Frame label.
>
> Here is a simple example of the problem:
>
> SetOptions[Plot, Frame -> True, FrameLabel -> "Wavelength (\[Mu]m)"]
> Plot[y = x, {x, 1, 1000},
> ColorFunction -> (ColorData["VisibleSpectrum"][#] &),
> ColorFunctionScaling -> False, Filling -> Axis]
>
> Notice the space between the Greek character \[Mu] and the m, causing the
> m to overlap the right parantheses. The space disappears if you remove
> the ColorFunction gradient from the plot parameters. Also, if you change
> \[Mu] to a standard character like m, the formatting looks perfectly
> acceptable. To be honest, I don't really understand the reason for the
> [#] & following the ColorData tag, but the gradient doesn't seem to work
> properly without it. Is my syntax correct?
I'm running under Windows and seeing this. My explanation may vary slightly in
the details if you're seeing this on another platform, but the essence should be
the same.
Under Windows, the drawing of VertexColors (the option by which color gradients
are implemented) is done using the 3D drawing system. One down side of using
the 3D drawing system is that it requires using a completely different method of
rendering fonts which is incapable of rendering ClearType.
For small font sizes such as those used in FrameLabels by default, antialiasing
actually reduces readability, unlike ClearType where it generally enhances
readability. So, since Mathematica is unable to use ClearType and standard
antialiasing would be less readable at this size, Mathematica turns off font
smoothing altogether. But at small sizes, roundoff issues and other limitations
can create the effect you're seeing of inappropriate spacing between characters.
Even though we only need the 3D drawing system to correctly render one piece of
the graphic, that choice affects the entire graphic, including frame labels.
The issue won't affect printing, where font smoothing is not needed, and it
won't be apparent under magnification, where the larger sizes allow better
on-screen rendering of the text.
Sincerely,
John Fultz
jfultz at wolfram.com
User Interface Group
Wolfram Research, Inc.