WRI Curve and Filling Colors
- To: mathgroup at smc.vnet.net
- Subject: [mg126830] WRI Curve and Filling Colors
- From: "djmpark" <djmpark at comcast.net>
- Date: Mon, 11 Jun 2012 00:01:46 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
Many thanks Bob. Picking up from what you did, I believe the colors can be specified slightly more simply as: curveColor[n_Integer] := Hue[Mod[0.67 + 0.2360679774997899`*(n - 1), 1], 0.6, 0.6] Table[curveColor[n], {n, 1, 15}] // Column The automatic FillingStyle appears to be specified by a Directive as follows: fillColor[n_Integer] := Opacity[0.2, curveColor[n]] Table[fillColor[n], {n, 1, 5}] // Column Then the question is: Does 0.2360679774997899 come from something interesting or is it just a trial and error choice? And although the colors do not exactly repeat, they are not all that distinguishable beyond the first four. David Park djmpark at comcast.net http://home.comcast.net/~djmpark/index.html From: Bob Hanlon [mailto:hanlonr357 at gmail.com] You can readily determine the default color scheme. p = Plot[Evaluate[ Table[a*x, {a, 15}]], {x, 0, 1}] The colors are colors = Cases[p, Hue[__], Infinity] {Hue[0.67, 0.6, 0.6], Hue[0.906068, 0.6, 0.6], Hue[0.142136, 0.6, 0.6], Hue[0.378204, 0.6, 0.6], Hue[0.614272, 0.6, 0.6], Hue[0.85034, 0.6, 0.6], Hue[0.0864079, 0.6, 0.6], Hue[0.322476, 0.6, 0.6], Hue[0.558544, 0.6, 0.6], Hue[0.794612, 0.6, 0.6], Hue[0.0306798, 0.6, 0.6], Hue[0.266748, 0.6, 0.6], Hue[0.502816, 0.6, 0.6], Hue[0.738884, 0.6, 0.6], Hue[0.974952, 0.6, 0.6]} Note that the green and blue components are constant at 0.6 and only the red component varies. Plotting the red component: n = 1; ListPlot[ c = Cases[colors, Hue[r_, 0.6, 0.6] :> {n++, r}, Infinity]] These are lines of constant slope f[{lb_, ub_}] := FindFit[ Select[c, lb <= #[[1]] <= ub &], a*x + b, {a, b}, x] f /@ {{1, 2}, {3, 6}, {7, 10}, {11, 15}} {{a -> 0.236068, b -> 0.433932}, {a -> 0.236068, b -> -0.566068}, {a -> 0.236068, b -> -1.56607}, {a -> 0.236068, b -> -2.56607}} red[n_?NumericQ] := Module[ {y = 0.236068 n + 0.433932}, y - Floor[y]]; Plot[red[x], {x, 0, 15.2}, Epilog -> {Red, AbsolutePointSize[3], Point[c]}] The colors are then color[n_Integer] := Hue[red[n], 0.6, 0.6] Bob Hanlon