Does anybody know how to mimic MATLAB's default scheme for DensityPlot
, just like this picture shows:
update
There are several answers already, Thank you very much.
But I am still wondering how to make the colorscheme more efficient.
Compare below cases:
<< "http://pastebin.com/raw/sqYFdrkY";
dd = Partition[Flatten[Table[Sin[x] Sin[y], {x, -4, 4, 0.01}, {y, -3, 3, 0.2}]], 2];
gnuplotTraditional = RGBColor[Sqrt[#], #^3, Sin[2 π #]] &;
ListDensityPlot[dd, PlotRange -> All,
ColorFunction -> ParulaCM]; // AbsoluteTiming
ListDensityPlot[dd, PlotRange -> All,
ColorFunction -> ColorData["SunsetColors"]]; // AbsoluteTiming
ListDensityPlot[dd, PlotRange -> All,
ColorFunction -> gnuplotTraditional]; // AbsoluteTiming
The timing result on my computer is
{1.25649, Null}
{0.496294, Null}
{0.584826, Null}
So methods using Blend
on color list is way too slow (consider ListDensityPlot
is already very slow in Mathematica with large data).
So is there a succinct color formula for MATLAB's parula
?
colorlist
in Jason's code, it's just as efficient:mycm = ParulaCM /. s_Apply :> RuleCondition[s, True]
. $\endgroup$parula
(both versions), 256 RGB triplets are packed into a matrix. (But that should have been a comment on my post instead as opposed to a comment here.) $\endgroup$