6
$\begingroup$

How can I use ONLY the central 90% of the spectrum, not the whole range? For example, I do not like to see the lowest values in purple, but in deep blue color.

tzvw={{394.5, 0.58, -0.56391}, {394.5, 0.56, -0.580086}, {394.5, 
0.54, -0.56415}, {394.5, 0.52, -0.561491}, {394.5, 
0.5, -0.572876}, <<3267>>, {90557.4, 0.1, -0.358004}, {90557.4, 
0.08, -0.2929}, {90557.4, 0.06, -0.240185}, {90557.4, 
0.04, -0.211586}, {90557.4, 0.02, -0.156428}}


 ShowLegend[
 ListContourPlot[tzvw,
  ColorFunction -> ColorData["Rainbow"], 
  Contours -> Range[-2.25, 2.75, 0.25], ContourLines -> False,
  FrameTicks -> {ticklst, Automatic, None, None},
  PlotRange -> {Automatic, {0, 0.52}, {-2.25, 2.75}}, FrameStyle -> 20,
  AspectRatio -> 0.3, ImageSize -> 700,
  "DelaunayDomainScaling" -> True,
  RegionFunction -> Function[{x, y, z}, y <= 0.5]]
$\endgroup$
1
  • $\begingroup$ This is not valid code. Please post code that can be evaluated and results in useful output (e.g. define tzvw). $\endgroup$
    – Yves Klett
    Apr 20, 2012 at 9:15

1 Answer 1

12
$\begingroup$

You can Rescale your points that are passed to ColorFunction so that they're between 0.05 and 0.95 as in the example below:

data = Table[Sin[i + j^2], {i, 0, 3, 0.1}, {j, 0, 3, 0.1}];
ListContourPlot[data, ColorFunction -> (ColorData["Rainbow"][
    Rescale[#, {0, 1}, {0.05, 0.95}]] &)]

enter image description here

$\endgroup$
9
  • 1
    $\begingroup$ beat me by 20 seconds. BTW, the default setting for ColorFunctionScaling is True, so you should use Rescale[#, {0, 1}, {0.05, 0.95}] (or set ColorFunctionScaling -> False). $\endgroup$
    – Heike
    Apr 20, 2012 at 9:23
  • $\begingroup$ @Heike Thanks, I knew I had forgotten something :) $\endgroup$
    – rm -rf
    Apr 20, 2012 at 9:26
  • $\begingroup$ Looks fine in the first glance but the result is more or less monochrome! $\endgroup$
    – K-1
    Apr 20, 2012 at 9:37
  • $\begingroup$ Thanks R.M but how can I send you the whole tzvw. Then you can see what happens if I apply your approach. $\endgroup$
    – K-1
    Apr 20, 2012 at 9:46
  • $\begingroup$ @K-1 You can't send files through this site. You should try and reduce your problem to a simpler sub-problem that can be easily posted in the question. It needn't even be your actual problem as long as it conveys your problem clearly. $\endgroup$
    – rm -rf
    Apr 20, 2012 at 10:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.