I wonder if there is a way to extract existing ColorFunction
and "override" it with a new function that will depend on original one. This question discusses different ways how to add transparency to 3D plot, including an "extraction procedure" proposed by @RunnyKine:
Trace[Plot[Sin[x], {x, 0, 2 Pi}], _Blend & ] //
Flatten // ReleaseHold
Trace[Plot[Sin[x], {x, 0, 2 Pi},
ColorFunction -> "Rainbow"], _Blend &] // Flatten // ReleaseHold
Trace[Plot[Sin[x], {x, 0, 2 Pi},
ColorFunction -> (#^2 &)], _Blend &] // Flatten // ReleaseHold
It works if you know in advance that the ColorFunction
uses Blend
, but for general ColorFunction
(case three in the above code) it doesn't work. These were just examples to illustrate the extraction algorithm. I want a procedure that will work for any plotting object without any assumptions about its ColorFunction
.
Is there a way to obtain ColorFunction
from plotting functions? I wonder if I'm missing some simple solution a la
ColorFunction /. Options[Plot] (* Automatic .. not very useful *)
Comments
Post a Comment