MathGroup Archive 2007

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

Search the Archive

Re: Does ColorFunction-> have different meanings to Plot3D and

  • To: mathgroup at smc.vnet.net
  • Subject: [mg83350] Re: Does ColorFunction-> have different meanings to Plot3D and
  • From: Szabolcs Horvát <szhorvat at gmail.com>
  • Date: Sat, 17 Nov 2007 05:43:20 -0500 (EST)
  • References: <fhjtbk$5n0$1@smc.vnet.net>

congruentialuminaire at yahoo.com wrote:
> Hello Mathematica UG:
> 
> I made a very simple 3D plot using a CF:
> 
> Plot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2},  ColorFunction -> (Hue[#]
> &)]
> 
> Then I made a contour plot of the identical function, also with CF:
> 
> ContourPLot[Sin[x + y^2], {x, -3, 3}, {y, -2, 2},  ColorFunction ->
> (Hue[#] &)]
> 
> Since I am using the identical function passed to the 2 plotting
> routines, I expect the color to show analogously. Specifically in the
> Plot3D, the color bands are straight and parallel to the y-axis. In
> the ContourPlot, the bands are curved with the contours.
> 
> Is it possible to make the CF correspond so that when both plots are
> shown, the color shows the correspondence between the plots (since the
> functions plotted are the same)? Alternatively, is there some other CF
> I can use with ContourPlot to accomplish the desired result?
> 

Try using
Plot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2},
  ColorFunction -> (Hue[#3] &)]
to colour the 3D plot in the same way as the contour plot.  I do not 
know of a simple way to colour the contour plot in the same way as the 
3D plot (you could try making it transparent and manually inserting a 
Hue gradient underneath it).

There is some (but not much) explanation about the different meanings of 
ContourPlot on its doc page, under "more information".

Szabolcs


  • Prev by Date: Get list of function variables?
  • Next by Date: Re: Get list of function variables?
  • Previous by thread: Re: Does ColorFunction-> have different meanings to Plot3D and
  • Next by thread: Re: Does ColorFunction-> have different meanings to Plot3D and