MathGroup Archive 1995

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

Search the Archive

Re: Problems with defintion of a ContourFunction

  • To: mathgroup at christensen.cybernetics.net
  • Subject: [mg1582] Re: Problems with defintion of a ContourFunction
  • From: rubin at msu.edu (Paul A. Rubin)
  • Date: Sat, 1 Jul 1995 03:58:10 -0400
  • Organization: Michigan State University

In article <3sg3od$8cq at news0.cybernetics.net>,
   Martina Giarre <giarre at lgmhp3.epfl.ch> wrote:
->Hello,
->
->I have some problems in defining a ContourFunction. I cannot
->specify a color for a certain z-value in a ListContourPlot.
->
->I did some tests but the results are strange:
->
->
->test = Transpose[{{1,2,3,4,5,6},{1,2,3,4,5,6},
->		{1,2,3,4,5,6},{1,2,3,4,5,6},
->		{1,2,3,4,5,6},{1,2,3,4,5,6}}];
->
->g = {1,2,3,4,5,6};
->tc = Table[{Hue[d]},{d,0.4,1,0.1}];
->c[f_]:=While[f<=1,Hue[0.9]]
->ListContourPlot[test,	PlotRange->{1,6}, 
->			Contours->g, 
->			ContourStyle->tc,
->			ContourShading->True,
->			ContourLines->True,
->			ColorFunction->c];
->
->Unfortunately, this gives the chosen colors for the
->ContourLines but the ContourShading is not done in the
->right way. Instead of the intervall f<=1 being of the color
->Hue[0.9], all intervalls are of Hue[0.9].
->
->What is the mistake I do and how to solve the problem?
->
->Thank you in advance. 
->
->Martina Giarre
->
The argument ListContourPlot sends to c is not the contour value but the 
*scaled* contour value (domain 0 to 1).  Change f<=1 to f <= .2; this is 
not exactly what you were proposing, but then values of the function less 
than 1 will not plot if your smallest selected contour is 1.

You do not want While, by the way - it causes a loop.  Try

   If[f<=.2,Hue[0.9],...]

where ... is replaced by the color you like for the other segments.

Paul

**************************************************************************
* Paul A. Rubin                                  Phone: (517) 432-3509   *
* Department of Management                       Fax:   (517) 432-1111   *
* Eli Broad Graduate School of Management        Net:   RUBIN at MSU.EDU    *
* Michigan State University                                              *
* East Lansing, MI  48824-1122  (USA)                                    *
**************************************************************************
Mathematicians are like Frenchmen:  whenever you say something to them,
they translate it into their own language, and at once it is something
entirely different.                                    J. W. v. GOETHE


  • Prev by Date: Re: FindMinimum [] more elegantly?
  • Next by Date: Mathematica Training
  • Previous by thread: Re: Problems with defintion of a ContourFunction
  • Next by thread: Help !! Subrutine for founding complex roots of a polinomy expression.