# VectorDensityPlot, [closed]

I'm trying to plot the following function for two different values of variable m. However, it seems the second figure never appears. Weirdly, I noticed that real numbers are being attributed to variables x and y.

mp[m_, r_, θ_] := {r^2 + Cos[m θ],r^2 - Sin[m θ]};
mc[m_, x_, y_]:=
Evaluate @ TransformedField["Polar" -> "Cartesian", mp[m, r, θ], {r, θ} -> {x, y}];

{VectorDensityPlot[mc[0, x, y], {x, -5, 5}, {y, -5, 5}],
VectorDensityPlot[mc[1, x, y], {x, -5, 5}, {y, -5, 5}]} • If I use the code in the image -- it seems the posted code has a theta missing the brackets, \Theta instead of \[Theta], the latter being what it shown in the image of the code -- it works and give a correct plot for both. Feb 13, 2019 at 2:52

mp[m_, r_, θ_] := {r^2 + Cos[m θ], r^2 - Sin[m θ]};

mc[m_, x_, y_] :=
Evaluate @ TransformedField["Polar" -> "Cartesian", mp[m, r, θ], {r, θ} -> {x, y}];

{VectorDensityPlot[mc[0, x, y], {x, -5, 5}, {y, -5, 5}],
VectorDensityPlot[mc[1, x, y], {x, -5, 5}, {y, -5, 5}]} • You might also consider to post the corrected code in copyable form. Feb 13, 2019 at 1:10
• Thanks for the suggestion. I must be missing something but had to insert the code line-by-line. Okay, only three lines! But it could get tedious. Probably there is a way to insert all the code at once, yes?
– mjw
Feb 13, 2019 at 1:57
• Copy (right-click->As Input) and paste does not work? Feb 13, 2019 at 1:59
• I tried that. Didn't quite work. The first two lines were copied correctly with proper indentation. The third line was not.
– mjw
Feb 13, 2019 at 2:07
• Anyways, you've already got my upvote. Welcome on Mathematica.StackExchange! Feb 13, 2019 at 2:22

Here we can get beautiful pictures

    mp = {r^2 + Cos[m*θ], r^2 - Sin[m*θ]};
mc = TransformedField["Polar" -> "Cartesian",
mp, {r, θ} -> {x, y}];
Table[VectorDensityPlot[mc, {x, -2, 2}, {y, -2, 2},
PlotLabel -> Row[{"m = ", m}], ColorFunction -> Hue,
StreamPoints -> Fine], {m, 0, 9}] • This is very nice! For m=7, for example, we see a regular heptagon and one of the heptagrams indicated in your figure. I wonder what it would take to see the other one (or is it somehow already in the picture?). [Weisstein, Eric W. "Heptagram." From MathWorld--A Wolfram Web Resource.] (mathworld.wolfram.com/Heptagram.html)
– mjw
Feb 14, 2019 at 0:55
• This is an interesting vector field. Perhaps the author will explain what it describes. Feb 14, 2019 at 1:20