MathGroup Archive 2007

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

Search the Archive

Re: Contour Lines colored by temperature scale

  • To: mathgroup at smc.vnet.net
  • Subject: [mg84056] Re: Contour Lines colored by temperature scale
  • From: Oliver Ruebenkoenig <ruebenko at uni-freiburg.de>
  • Date: Fri, 7 Dec 2007 06:56:46 -0500 (EST)
  • References: <fjb087$s51$1@smc.vnet.net>


Dear John,

for the following to work you have to install IMS:
http://www.imtek.uni-freiburg.de/simulation/mathematica/IMSweb/

Needs["Imtek`UnstructuredPlot`"];
nx = 6; ny = 6;
coordinates = Flatten[Table[{1. i, 1. j}, {i, 0, nx - 1}, {j, 0, ny - 1}], 1];
incidence =
     Flatten[Table[{{j*nx + i + 1,
             j*nx + i + 2, (j + 1)*nx + i + 1}, {j*nx + i + 2, (j + 1)*nx +
               i + 2, (j + 1)*nx + i + 1}}, {i, 0, nx - 2}, {j, 0, ny - 2}],2];

values = .3*((#[[1]] - 3)*(#[[2]] - 3)) & /@ coordinates;
ucp = imsUnstructuredMeshPlot[coordinates, incidence];

{ma, mi} = Through[{Max, Min}[values]];

myContours = Range[ ma, mi, -0.2 ];
hueVals = (ma + mi)/Length[myContours];
allConts = {Thickness[0.01], Hue[ 1 - hueVals*# ],
           Line /@ imsFindContour[ coordinates, incidence, values,
                 myContours[[#]] ][[All, -1]]} & /@ 
Range[Length[myContours]];

Show[ {  ucp, Graphics[ allConts ] }, AspectRatio -> 1 ]

Hope this helps,
Oliver

On Fri, 7 Dec 2007, JOHN ERB wrote:

> I am using the following code to get colored contour lines.
>
> ListContourPlot[doseArray,Contours->{200,400,600,800,900},ContourShading->None,
> ContourStyle->{Blue,Green,Yellow,Orange,Red},ContourLabels->(Text[Framed[#3],{#1,#2},
> Background->White]&),AspectRatio->Automatic,InterpolationOrder->1];
>
> I would like to use a "Temperature" scale to color my contour lines;
> the higher values at the red end of the visible light spectrum, and the lower
> values at the blue end.  And instead of specifically naming the colors (as in
> the code above), I would like it to be generic so that I could just have a list
> of values for the contours, and the function automatically map the requisite colors.
>
> Thanks for your help.
>
> John C. Erb
>
>

Oliver Ruebenkoenig, <ruebenko AT uni-freiburg.de>


  • Prev by Date: Re: Ndsolve
  • Next by Date: Re: forming filename string
  • Previous by thread: Contour Lines colored by temperature scale
  • Next by thread: Re: Contour Lines colored by temperature scale