Re: ContourPlots,DensityPlots
- To: mathgroup at smc.vnet.net
- Subject: [mg23615] Re: ContourPlots,DensityPlots
- From: "Atul Sharma" <atulksharma at yahoo.com>
- Date: Wed, 24 May 2000 02:16:16 -0400 (EDT)
- Organization: McGill University
- References: <8g5frm$gbq@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Bob Hanlon's answer as usual is concise and effective. One objection that I have had to using the color function Hue is that Hue[0] and Hue[1] both appear as red, which confuses (me at least). For this reason, I usually replace Hue[#] with Hue[1-#/2], so as to assign unique colors. Modifying Bob's solution to accomodate this minor prejudice of my own gives the following, which scales your contours between blue and red. A similar scaling could be accomplished with RGBColor[0.3+ 0.7 #, 0.4, 0.8] I found Chapter 4 in Stan Wagon's book an excellent introduction to these color scales. HTH. A.S. : Needs["Graphics`Legend`"] data = Table[ 10.*Sin[x + y]Cos[x - y], {x, xmin = -Pi, xmax = Pi, Pi/24.}, {y, ymin = -Pi, ymax = Pi, Pi/24.}]; Plot3D[10Sin[x + y]Cos[x - y], {x, xmin, xmax}, {y, ymin, ymax}, PlotPoints -> 25]; ShowLegend[ ListContourPlot[data, ColorFunction -> (Hue[1 - #/2] &), Contours -> 12, ContourLines -> False, DisplayFunction -> Identity], {Hue[1 - #/2] &, 11, ToString[Max[data]], ToString[Min[data]], LegendPosition -> {1.1, -.4}}]; ShowLegend[ ListDensityPlot[data, ColorFunction -> (Hue[1 - #/2] &), Mesh -> False, DisplayFunction -> Identity], {Hue[1 - #/2] &, 11, ToString[Max[data]], ToString[Min[data]], LegendPosition -> {1.1, -.4}}]; -- ------------------------------------------------------------------------- Atul Sharma MD, FRCP(C) Pediatric Nephrologist, McGill University/Montreal Children's Hospital Paul Hoke wrote in message <8g5frm$gbq at smc.vnet.net>... > >Anybody have a lot of experience with ListContourPlot and >ListDensityPlot? > >I have a matrix of data I want to plot and show for a presentation. > >The problems I am having are as follows > >with ColorFunctionScaling->True, It doesn't seem that the colors have >any thing to do with the actual values if I use a legend and use >ColorFunction->Hue, the scale is on the plot doesn't equal the legend >since the data is truncated to fit 0-1. > >I'm trying to divide by the largest value since all my data is positive >and then the legend color scheme should fit the data plot except I don't >have a zero in my data to peg the lower end. I hate to add a zero in my >matrix just to fix the lower end of the color scheme, is that the only >option? > >I can delineate which contours I want, but I can't label them. Is there >anyway to print the value of contours? That is on the plot have each >contour marked so that it isn't just a bunch of lines? > >Thanks in advance, >Paul > > >________________________________ >Paul Hoke >A107 Research Complex Engineering >Michigan State University >East Lansing MI 48824 > >Hokepaul at egr.msu.edu >Office 517.353.9952 >Lab 517.353.6434 >Fax 517.353.7179 >