Re: Bug in ColorFunctionScaling ???
- To: mathgroup at smc.vnet.net
- Subject: [mg39453] Re: Bug in ColorFunctionScaling ???
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Sun, 16 Feb 2003 06:13:56 -0500 (EST)
- References: <b2fqud$k9q$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Just to be specific about the point made by earlier contributers to this thread - that what you are seeing is the result of Mathematica clipping the plot range to what it thinks is significant, and that this can be avoided by setting PlotRange->All. With dp=ListDensityPlot[matrix]; We have PlotRange[dp][[3]] {0.,0.000092028} Which is a very small part of the range of matrix values: Through[{Min,Max}[matrix]] {6.532730362808272*^-22, 0.9373917995816773} So every matrix value at or above 0.000092028 gives white and each value,v , in {0.,0.000092028} gives GrayLevel[v/0.000092028]. The latter scaling gives more discrimination than you want in the this range. This clipping does not occur with BarChart3D because the default setting is PlotRange -> All. But it does occur with ListPlot3D[matrix]; -- Allan --------------------- Allan Hayes Mathematica Training and Consulting Leicester UK hay at haystack.demon.co.uk Voice: +44 (0)116 271 4198 Fax: +44 (0)870 164 0565 "Cesar Guerra" <guerra_cesar at yahoo.com> wrote in message news:b2fqud$k9q$1 at smc.vnet.net... > > > Hi math group > > working with the matrix given at the end of this mail I had troubles trying to visualize it. For instance > > ListDensityPlot[matrix] > > works too bad as can be seen using a 3D chart > > <<Graphics`Graphics3D` > > BarChart3D[matrix] > > I got the correct density plot when I scaled the matrix elements by hand: > > min = Min[matrix]; > > max = Max[matrix]; > > ListDensityPlot[matrix,ColorFunctionScaling->False,ColorFunction->(GrayLevel [(#-min)/(max-min)]&)]; > > The question: is it a bug or I lost something in the way? A similar problem arises with many matrices that I generated in which there are many numbres close to zero. > > Regards.. Cesar, > > Well here is the matrix. Sorry because of the horrible format > > matrix={{0.024880970532441947`,0.13578975670808227`,0.027812229119535358`, > 0.0033045651867030673`,0.0003347493056088158`,0.000026302686284994582`, > 0.00004371748398547436`,0.00003681120741920656`,0.00003087537872290685`, > 0.00001905600654956626`,0.000011958703618226977`,5.517957585379249`*^-6, > 1.8928075271017263`*^-6,5.269301156366419`*^-7, > 6.489638911064354`*^-8},{0.13578975670808227`,0.9373917995816773`, > 0.19133899349592184`,0.02294180236292207`,0.002146876534122984`, > 0.00002231000770522592`,0.0001344726022920243`,0.00012287370329599313`, > 0.00011865976751467771`,0.00008588847348107676`,0.0000650218873670948`, > 0.00003769993910579926`,0.000017332922552971424`,7.275477707153364`*^-6, > 1.801352169404378`*^-6},{0.027812229119535358`,0.19133899349592184`, > 0.03906478452215391`,0.004681738877149381`,0.0004385133576867982`, > 4.090272132604937`*^-6,0.000027823395408896714`, > 0.000025374358467023346`,0.00002443091259330744`,0.0000176320249591744`, > 0.000013309659796768249`,7.69480720132288`*^-6,3.5276710986778535`*^-6, > 1.47654392225098`*^-6,3.645535247058728`*^-7},{0.0033045651867030673`, > 0.02294180236292207`,0.004681738877149381`,0.0005797298493723746`, > 0.000052839536129011784`,4.7226000276470905`*^-7,3.368374620650723`*^-6, > 3.069745381714908`*^-6,2.952410460102803`*^-6,2.12852330993168`*^-6, > 1.605032461433652`*^-6,9.269514851713523`*^-7,4.2451346697061517`*^-7, > 1.7749887062983138`*^-7,4.377821687374563`*^-8},{0.0003347493056088158`, > 0.002146876534122984`,0.0004385133576867982`,0.000052839536129011784`, > 9.255816438202384`*^-6,4.1249326083329274`*^-8,3.0266675833749047`*^-7, > 2.757224026816698`*^-7,2.650178380130713`*^-7,1.9094596136360029`*^-7, > 1.43896434791398`*^-7,8.305350785567792`*^-8,3.801262097259811`*^-8, > 1.588429369111028`*^-8, > 3.915317215838556`*^-9},{0.000026302686284994582`, > 0.00002231000770522592`,4.090272132604937`*^-6,4.7226000276470905`*^-7, > 4.1249326083329274`*^-8,3.535859690725517`*^-6,2.1961201225893756`*^-8, > 2.0000362799666382`*^-8,1.92152398727093`*^-8,1.3838515977742497`*^-8, > 1.0424076404006913`*^-8,6.0138740883614725`*^-9,2.7512702310528075`*^-9, > 1.1491658404200648`*^-9, > 2.831335936719118`*^-10},{0.00004371748398547436`, > 0.0001344726022920243`,0.000027823395408896714`,3.368374620650723`*^-6, > 3.0266675833749047`*^-7,2.1961201225893756`*^-8,1.3721693600020958`*^-6, > 1.2199036050151096`*^-9,1.17158414848564`*^-9,8.434512469918671`*^-10, > 6.351128550113803`*^-10,3.6627785449735637`*^-10, > 1.675069186742091`*^-10,6.993998508257666`*^-11, > 1.7225733012431472`*^-11},{0.00003681120741920656`, > 0.00012287370329599313`,0.000025374358467023346`,3.069745381714908`*^-6, > 2.757224026816698`*^-7,2.0000362799666382`*^-8,1.2199036050151096`*^-9, > 5.794192640789079`*^-7,6.135409523313631`*^-11,4.4155949418835226`*^-11, > 3.3238340437588365`*^-11,1.916277391009494`*^-11, > 8.760720928814635`*^-12,3.6567233858746355`*^-12, > 9.003344351753371`*^-13},{0.00003087537872290685`, > 0.00011865976751467771`,0.00002443091259330744`,2.952410460102803`*^-6, > 2.650178380130713`*^-7,1.92152398727093`*^-8,1.17158414848564`*^-9, > 6.135409523313631`*^-11,2.6403332491754`*^-7,2.0055352842629293`*^-12, > 1.509195581203532`*^-12,8.698207176501544`*^-13,3.975359904169974`*^-13, > 1.6587999868150363`*^-13, > 4.0829224450233844`*^-14},{0.00001905600654956626`, > 0.00008588847348107676`,0.0000176320249591744`,2.12852330993168`*^-6, > 1.9094596136360029`*^-7,1.3838515977742497`*^-8,8.434512469918671`*^-10, > 4.4155949418835226`*^-11,2.0055352842629293`*^-12,7.78759863903862`*^-8, > 5.953442715856466`*^-14,3.4301675965039096`*^-14, > 1.567201965631006`*^-14,6.53740694684916`*^-15, > 1.6085914870370433`*^-15},{0.000011958703618226977`, > 0.0000650218873670948`,0.000013309659796768249`,1.605032461433652`*^-6, > 1.43896434791398`*^-7,1.0424076404006913`*^-8,6.351128550113803`*^-10, > 3.3238340437588365`*^-11,1.509195581203532`*^-12, > 5.953442715856466`*^-14,2.9305747143573262`*^-8, > 1.1656559281957215`*^-15,5.323917587243905`*^-16, > 2.2200368196954134`*^-16, > 5.4608078423152933`*^-17},{5.517957585379249`*^-6, > 0.00003769993910579926`,7.69480720132288`*^-6,9.269514851713523`*^-7, > 8.305350785567792`*^-8,6.0138740883614725`*^-9,3.6627785449735637`*^-10, > 1.916277391009494`*^-11,8.698207176501544`*^-13, > 3.4301675965039096`*^-14,1.1656559281957215`*^-15,7.76299670479757`*^-9, > 1.5221789994509213`*^-17,6.345037635961268`*^-18, > 1.5602293071790306`*^-18},{1.8928075271017263`*^-6, > 0.000017332922552971424`,3.5276710986778535`*^-6, > 4.2451346697061517`*^-7,3.801262097259811`*^-8,2.7512702310528075`*^-9, > 1.675069186742091`*^-10,8.760720928814635`*^-12,3.975359904169974`*^-13, > 1.567201965631006`*^-14,5.323917587243905`*^-16, > 1.5221789994509213`*^-17,1.6163732178696085`*^-9, > 1.4386200807791453`*^-19, > 3.530345878524741`*^-20},{5.269301156366419`*^-7,7.275477707153364`*^-6, > 1.47654392225098`*^-6,1.7749887062983138`*^-7,1.588429369111028`*^-8, > 1.1491658404200648`*^-9,6.993998508257666`*^-11, > 3.6567233858746355`*^-12,1.6587999868150363`*^-13, > 6.53740694684916`*^-15,2.2200368196954134`*^-16,6.345037635961268`*^-18, > 1.4386200807791453`*^-19,3.740548209112563`*^-10, > 6.532730362808272`*^-22},{6.489638911064354`*^-8,1.801352169404378`*^-6, > 3.645535247058728`*^-7,4.377821687374563`*^-8,3.915317215838556`*^-9, > 2.831335936719118`*^-10,1.7225733012431472`*^-11, > 9.003344351753371`*^-13,4.0829224450233844`*^-14, > 1.6085914870370433`*^-15,5.4608078423152933`*^-17, > 1.5602293071790306`*^-18,3.530345878524741`*^-20, > 6.532730362808272`*^-22,4.517936598686041`*^-11}} > > >