Suppose I have four dimensional data, i.e. at each point in the plane, I have two numbers associated with it. For example, {{{1,1},{f[1,1],g[1,1]}},{{1,2},{f[1,2],g[1,2]}},...}. My data would not make sense to plot as a vector field. Instead, I would like to color each point, where its darkness corresponds to the size of f, and its hue corresponds to g. So at the end of the day, it would look like a ContourPlot, where the ColorFunction takes the function values as input.

Any help is greatly appreciated!


1 Answer 1


Here is a solution that seems to work:

customColor[xx_, yy_] := 
 Blend[{Hue[0, 1, yy], Hue[0.2, 1, yy], Hue[0.4, 1, yy], 
   Hue[0.6, 1, yy], Hue[0.8, 1, yy]}, xx]
dataTest = { {1, 1, 0.1, 0.3}, {1, 2, 1, 1}, {2, 1, 0.5, 0.1}, {2, 2, 
    0.7, 0}};
Graphics[{customColor[#3, #4], Rectangle[{#1, #2}]} & @@@ dataTest, 
 Frame -> True]

Your Answer

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

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