Re: Density Plot coloring issue
- To: mathgroup at smc.vnet.net
- Subject: [mg79745] Re: [mg79715] Density Plot coloring issue
- From: DrMajorBob <drmajorbob at bigfoot.com>
- Date: Fri, 3 Aug 2007 06:29:13 -0400 (EDT)
- References: <4552697.1186048615067.JavaMail.root@m35>
- Reply-to: drmajorbob at bigfoot.com
numCols and numRows are undefined. Bobby On Thu, 02 Aug 2007 02:56:32 -0500, Yvon <ymgrigsb at yahoo.com> wrote: > I'm having an issue where my density plot will color all the cells > EXCEPT the minimum above 0 and maximum values in my list. It seems to= > occur irregardless of whether I use the custom function I wrote or > ColorFunction -> (Hue[2/5, 2/3, 1.2 - #] &) > > This is driving me crazy, please tell me what I'm doing wrong. For > the dataset given below, all the cells are colored except cell 3,4 > (value=3.93) and cell 6,1(value=7.41) They are white, along with = the > 0.0 values which is the first value in my color table. > > However, if I duplicate the min value by changing another value > within the list (for example, replace (cell1,1) 6.75 with 3.93), then > the color for both 3.93 cells change to what is expected. If I > replace 6.75 with 7.41, both 7.41 cells are white, if I replace 6.75 > with 7.42, then cell 1,1 is white and the cell 6,1 changes to what is > expected. Can someone tell me what is going on here?!! > > cList = {{6.75, 5.85, 0., 6.39, 7.41, 0.}, {6.4, 5.57, 0., 6.6, 6.68= , > 0.}, {5.99, 5.51, 0., 6.24, 6.37, 0.}, {6.1, 5.72, 3.93, 5.92, > 5.89, 0.}, {5.71, 5.85, 6.05, 5.92, 6.06, 0.}, {5.62, 5.64, 5.61, > 5.42, 5.14, 0.}, {0, 0, 0, 0, 0, 0}} > > numColors = 10 > minLWC = 0 > maxLWC = 10 > > CellColor[index_] := Module[{cTable, s}, > (*White,purple,blue, light blue, light green, kahki, light yellow, > light orange, pink, red *) > cTable = {{1, 1, 1}, {0.5, 0, 0.5}, {0.4, .6, > 0.9}, {0.7, .9, .96}, {.8, 1, .7}, {.6, 0.8, .2}, {1, 1, > 0.5}, {1, .84, 0}, {1, .75, .8}, {.86, .08, .24}}; > s = Partition[Map[RGBColor, cTable], 1]; > RGBColor[cTable[[index]]] > ] > > GetColor[x_] := (p = > Round[Abs[(x - minLWC)*numColors/(maxLWC - minLWC)]] ; > CellColor[p]) > > ListDensityPlot[cList, InterpolationOrder -> 0, > ColorFunction -> GetColor, ColorFunctionScaling -> {\!\(\* > ButtonBox["False", > BaseStyle->"Link", > ButtonData->"paclet:ref/True"]\)}, > Mesh -> {numCols - 1, numRows - 1}, PlotRangePadding -> None, > DataRange -> {{0, numCols}, {0, numRows}}, > Epilog -> {Hue[0, 1, 1], > MapIndexed[Text[#1, #2 - .5] &, Transpose[cList], {2}]}] > > Your help is greatly appreciated!! > > Yvon > > > -- = DrMajorBob at bigfoot.com