I want to use ListContourPlot to display all negative values using one colorscheme and all positive values using another color scheme. This question Define a color function using Piecewise gives some hints, but if I use something like this
colorFunc[x_] := Piecewise[{{"AlpineColors", x >= 0},
{"SouthwestColors", x < 0}}];
ListContourPlot[data, ColorFunction -> colorFunc]
I get the error message:
AlpineColors is not a Graphics primitive or directive
Any idea?
Thanks in advance.
Edit1:
I used kguler's suggestion which works with most data. However, in some cases I get results like this:
using
ListContourPlot[data, Contours -> 10,ColorFunction -> (Piecewise[{{ColorData["NeonColors"][#], # > 0.5}, {ColorData["Aquamarine"][#], # <= 0.5}}] &),ContourLabels -> All]
The Aquamarine colors should code only for negative values and not for positive ones. What does go wrong?
ColorFunction -> "name"
is equivalent toColorFunction -> (ColorData["name"][#i]&)
where the slot used is as follows...." Using a string name is a special case and the string has to appear by itself after the->
for it to be handled as aColorData
name for you. To do what you want, you have to do all the work in your program, as in the answer(s). $\endgroup$ColorFunctionScaling -> False
. $\endgroup$