# DensityPlot for function defined via preimage of region

I have a set of functions of two variables, which are defined via a coordinate change. Now I want to visualize them on the image of the coordinates. I can do this in 3D with ParametricPlot3D:

x =   1/3 (
Exp[2 Pi I #[[1]]] + Exp[2 Pi I #[[2]]] +
Exp[-2 Pi I (#[[1]] + #[[2]])]) &;
y = 1/3 (
Exp[- 2 Pi I #[[1]]] + Exp[-2 Pi I #[[2]]] +
Exp[2 Pi I (#[[1]] + #[[2]])]) &;
xr = 1/2 ( x @ {#1, #2} + y @ {#1, #2}) &;
yr = 1/(2 I ) ( x@ {#1, #2} - y @ {#1, #2}) &;
T[n_, m_] :=
1/6 ( Exp[ 2 Pi I (m #1 - n #2)] +  Exp[ 2 Pi I (-n #1 + m #2)] +
Exp[2 Pi I ((m + n) #1 + n #2)] +
Exp[ 2 Pi I (n #1 + (n + m) #2)] +
Exp[ 2 Pi I ((-n - m) #1 - m #2)] +
Exp[ 2 Pi I (-m #1 - (n + m) #2)]) &;
ParametricPlot3D[{Re[xr[u, v]], Re[yr[u, v]], Re[T[2, 0][u, v]]}, {u,
0, 1}, {v, 0, 1}]


But I would prefer a 2D density plot. I can not use regions, as I do not want to calculate the inverse map of the coordinate change. What would be the easiest way to achieve this?

• You can use ColorFunction with your ParametricPlot3D to get the density plot look, and drop the z cooordinate. Jul 21 '17 at 16:01

You can use the ColorFunction option to RegionPlot for this:

ParametricPlot[{Re[xr[u, v]], Re[yr[u, v]]}, {u, 0, 1}, {v, 0, 1},
ColorFunction -> Function[{x, y, u, v}, Hue@Re[T[2, 0][u, v]]],
PlotPoints -> 30]


By using two coordinates as the arguments to RegionPlot, you get the desired deltoid area. Then the function Re@T is encoded in ColorFunction. To get a better quality display, it may be necessary to add MaxRecursion -> 4

This yields the following:

• This one seems to be perfect. Thanks. Jul 21 '17 at 17:52

Just drop the z-function:

DensityPlot[{Re[xr[u, v]], Re[yr[u, v]]}, {u, 0, 1}, {v, 0, 1}]


Something like this?

ParametricPlot3D[{Re[xr[u, v]], Re[yr[u, v]], Re[T[2, 0][u, v]]}, {u,
0, 1}, {v, 0, 1},
ViewPoint -> {0, 0, Infinity},
ColorFunction -> "Rainbow"]


• No I want the z-values to be displayed as density in the image of the maps xr[u,v], yr[u,v] (a deltoid). So the function to be displayed is T[n,m] and the coordinates are xr, yr. Jul 21 '17 at 15:51
• Yes the modified answer would be fine :) I did not accept this as an answer, as the one of Jens is nicer, and I can only accept one, but yours is also good. Jul 21 '17 at 17:50