Re: Does ColorFunction-> have different meanings to Plot3D and
- To: mathgroup at smc.vnet.net
- Subject: [mg83291] Re: [mg83276] Does ColorFunction-> have different meanings to Plot3D and
- From: "Ricardo Samad" <resamad at gmail.com>
- Date: Sat, 17 Nov 2007 05:12:46 -0500 (EST)
- References: <200711161041.FAA05001@smc.vnet.net>
Dear Roger, The simplest way is to use Hue instead of (Hue[#]&): Plot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2}, ColorFunction -> Hue] ContourPlot[Sin[x + y^2], {x, -3, 3}, {y, -2, 2}, ColorFunction -> Hue] When you define the CF as you did, in ContourPlot the CF is related to the = z coordinate, or the function height, as expected, but in Plot3D there are three arguments for the CF: # or #1 is the x-coordinate, #2 the y-coordinat= e and #3 the z-coordinate, the one that you want: Plot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2}, ColorFunction -> (Hue[#3] &)] ContourPlot[Sin[x + y^2], {x, -3, 3}, {y, -2, 2}, ColorFunction -> Hue] This second syntax offers more control over the plot, as for example in: Plot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2}, ColorFunction -> (Hue[#1 + #2 + #3] &), PlotPoints -> 50, Mesh -> False] Best regards, Ricardo On Nov 16, 2007 7:41 AM, <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? > > TIA. > > Regards..Roger W. > > -- ____________________________________ Ricardo Elgul Samad tel: (+55 11) 3133-9372 fax: (+55 11) 3133-9374 Centro de Lasers e Aplica=E7=F5es IPEN/CNEN-SP AV. Prof. Lineu Prestes 2242 Cidade Universit=E1ria 05508-000 S=E3o Paulo - SP Brazil ____________________________________
- References:
- Does ColorFunction-> have different meanings to Plot3D and
- From: congruentialuminaire@yahoo.com
- Does ColorFunction-> have different meanings to Plot3D and