integrity of ListContourPlot, ListDensityPlot
- To: mathgroup at smc.vnet.net
- Subject: [mg23730] integrity of ListContourPlot, ListDensityPlot
- From: "Paul Hoke" <hokepaul at pilot.msu.edu>
- Date: Mon, 5 Jun 2000 01:09:22 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
This question was raised after some help I received previously. It appears that ListContourPlot and ListDensityPlot can sometimes in appropriately display colors if there are a few extreme points in the data field. If the following notebook is run it works just fine: "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 -> 11, ContourLines -> False, DisplayFunction -> Identity], {Hue[1 - #/2] &, 11, ToString[Min[data]], ToString[Max[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}}]; However, if the first data point is changed to -90 and then the entire re-plot the data, the all of the values appear to be represented incorrectly in the legend. The minimum on the legend will be reported as -90 and all of the regions between -8 to -10 will appear as -60 when shaded if it is assumed that the legend applies a linear scale between the minimum and maximum Insert the following into the above notebook (the matrixform is just to inspect the data to just to see the raw data table) data[[1,1]]=-50 MatrixForm[data] "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.}]; data[[1, 1]] = -90 ; MatrixForm[data] Plot3D[10Sin[x + y]Cos[x - y], {x, xmin, xmax}, {y, ymin, ymax}, PlotPoints -> 25]; ShowLegend[ ListContourPlot[data, ColorFunction -> (Hue[1 - #/2] &), Contours -> 11, ContourLines -> False, DisplayFunction -> Identity], {Hue[1 - #/2] &, 11, ToString[Min[data]], ToString[Max[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}}]; if anybody has any input regarding this phenomena, I would greatly appreciate it. 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