MathGroup Archive 2001

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Two questions concerning ListDensityPlot ...

  • To: mathgroup at smc.vnet.net
  • Subject: [mg28517] Re: Two questions concerning ListDensityPlot ...
  • From: "Ersek, Ted R" <ErsekTR at navair.navy.mil>
  • Date: Tue, 24 Apr 2001 01:48:52 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Kattnig  wrote,
I'm desperately looking for a color function that allows the intermediate
values to be kept white, while maxima and minima are colored red and blue
respectively with the "color intensity" indicating their absolute value.
Applied to my sparse matrix problem I want the negative entries to be blue,
the positive to be red whereas the majority of entries corresponding to zero
should remain white. 
-------------

Use the following matrix as an example.

In[1]:=
   lst=Table[Random[Real,{-50,50}],{25},{25}]; 

Are you sure you want to use the same color for 0 and Indeterminate?  Well
if you do replace 
(x==0) with (x==0||x===Indeterminate) below.
This is a case where beauty is in the eye of the beholder.  I think the
following works nicely.


In[2]:=
   Shade[x_]:=Which[x==0,Hue[0,0,1],
      x>0,If[large==0,Hue[0.0,0.0,1.0],Hue[0.0,0.1+0.7*x/large ,1.0]],
 
x<0,If[small==0,Hue[0.0,0.0,1.0],Hue[0.66666666666667,0.1+0.7*Abs[x/small],1
.0]],
      True, (* Should never get here. *)Abort[] 
   ]


In[3]:=
    large=Max[Max[lst], 0];
    small=Min[Min[lst], 0];
    ListDensityPlot[ lst, ColorFunction->Shade,
ColorFunctionScaling->False]; 

(*---------------*)
You had another problem with the tick marks.  I could probably solve that
too, but I am running out of time.  Chances are somebody else will give a
solution.  If I don't see a solution after a few days I will look into it.

--------------------
About visualizing complex functions you could do the following:

   Plot3D[ Abs[ func[a + b I] ],  
         {a,amin,amax},{b,bmin,bmax}, ColorFunction->(Arg[#]/(2*Pi)+1&)   
   ]

I forget who it was but somebody had a nice package on a website that did
this sort of thing.

----------
Regards,
  Ted Ersek



  • Prev by Date: Re: Programming question about multiple assignments in the Coefficients Matrix
  • Next by Date: Re: Algebraic Integers
  • Previous by thread: Two questions concerning ListDensityPlot ...
  • Next by thread: RE: Two questions concerning ListDensityPlot ...