Simple Question: I want to create beautiful density plots like those on a Wikipedia page:
Mathematica has a lot of built-in color functions but none of them is as good as Wikipedia's. I tried "Rainbow", "DarkRainbow", Hue, "TemperatureMap" and "ThermometerColors" so far.
I plot density plots of Zernike Polynomials with "Zernike.m" package. The code I use is as follows:
ClearAll["Global`*"]
<< "Zernike.m"
Table[DensityPlot[
Zernike[i, Norm[{x, y}], ArcTan[x, y]], {x, y} \[Element] Disk[],
PlotRange -> All, ColorFunctionScaling -> False, PlotPoints -> 100,
Frame -> False, ColorFunction -> "TemperatureMap",
ColorFunctionScaling -> True], {i, 1, 10}]
And the result I'm not satisfied is as follows:
How can I use a color function or create a color function like the one on the Wikipedia? Any advice is appreciated.
Answer
If the built-in color schemes here are not good for you, you can write your own.
See for example a scheme that I often use:
scheme = (Blend[{RGBColor[0.02, 1, 1], RGBColor[0, 0.48, 1], RGBColor[
0, 0, 0.73], Black, RGBColor[0.6, 0.22, 0], RGBColor[1, 0.55, 0],
White}, Rescale[#1, {-1, 1}]] &);
BarLegend[{scheme[#] &, {-1, 1}}]
You can change the colours of the scheme to obtain the combination you like the most.
See this question I asked some time ago for some useful details!
Comments
Post a Comment