Hi, all,
I was curious about the colors used automatically for multiple lists in
graphics such as ListPlot. I know that it looks as though the colors are
reused after about four datasets, but I wanted to test this, so I cobbled
together a quick set of commands. It turns out that the colors are not
reused, but it's hard to see on smallish plots:
(* Create a plot with many data sets so we may include a lot of colors: *)
g = ListPlot[(Range[10]*#1 & ) /@ Range[10, 0.1, -0.1],
PlotStyle -> PointSize[0.02]]
(* A function to extract the hues returned in a graphics object: *)
ColorsFromGraphics[graphics_] := Level[Cases[graphics, __Hue, Infinity],
{-2, -2}]
(* colors used in our plot 'g': *)
cols = ColorsFromGraphics[g]
(* it turns out that all of the points have the same saturation and
brightness, but many more hues appear than just four: *)
hues = cols /. Hue[a__] :> (First@{a})
ListPlot[hues]
(* note that in the ListPlot of hues, the first four hues wrap around the
range {0, 1} quite nicely, but when you get to the fifth hue, it falls quite
close to the first one, etc. *)
(* The hues have a constant offset, sequentially added, presumably so that
they wrap around the "hue space" without repeating themselves: *)
ListPlot[Differences@hues]
(* but I'm not sure where the chosen number comes from -- it looks as though
it's chosen to be a "maximal irrational", so that the hues don't repeat, and
the same number shows up when perusing the scientific literature about
Hausdorff dimensions and so on in physical systems. Can anyone shed some
light on it? *)
Cheers,
C.O.
--
==========================================================
Curtis Osterhoudt
cfo at remove_this.lanl.and_this.gov
PGP Key ID: 0x4DCA2A10
Please avoid sending me Word or PowerPoint attachments
See http://www.gnu.org/philosophy/no-word-attachments.html
==========================================================