To interpret electron backscatter diffraction (EBSD) results, inverse pole figures are used. A three dimensional space of directions ([100], [110] and [111] for those who know about crystallography) is projected to a color map, such that purely [100] oriented points are colores red, [110] green and [111] blue, respectively. Mixtures of orientations are colored in mixed colors. Usually, a legend like this one is used:
I want to recreate the legend in Mathematica, but unfortunately I don't know how exactly the thre dimensional orientation space is projected to the two dimensional wedge.
Obviously, the colors used in the legend are those from half the surface of the $(r,g,b)$ color space, as shown in this plot:
RegionPlot3D[
And @@ Thread[0 <= {x, y, z} <= 1] && x + y + z > 1,
{x, 0, 1}, {y, 0, 1}, {z, 0, 1},
ColorFunction -> (RGBColor[#1, #2, #3] &),
Mesh -> None,
ViewPoint -> {20,20,20},
Lighting -> {{"Ambient", White}},
Boxed -> False
]
Since I dont't know how to project that surface onto the wedge, I tried to recreate the legend by hand. The wedge shape was easy, but I can't seem to get the ColorFunction
right. Here's what I tried:
myColorFunction =
RGBColor[
Piecewise[{{1, #3 <= 0.5}, {(2*(1 - #3))^2, True}}],
Piecewise[{{1, #3 >= 0.5 && #4 < 0.5}, {(2*(1 - #4))^2, #3 >= 0.5 && #4 >= 0.5},
{(2*#3)^2, #3 < 0.5 && #4 < 0.5}, {(4*#3*(1 - #4))^2, True}}],
Piecewise[{{(2*#4)^2, #3 >= 0.5 && #4 < 0.5}, {1, #3 >= 0.5 && #4 >= 0.5},
{(4*#3*#4)^2, #3 < 0.5 && #4 < 0.5}, {(2*#3)^2, True}}]] &;
With[{rstart = 1, rend = 1.15, phi = 42 \[Degree]},
ParametricPlot[
r (1 + (p/phi)^2 (rend - rstart)) {Cos[p], Sin[p]}, {r, 0, rend}, {p, 0, phi},
ColorFunction -> myColorFunction,
Mesh -> None,
Frame -> False,
Axes -> False]]
I already like the outer part, but i can't reproduce the three triangular whitish lines in the middle (which obviously correspond with the edges of the $(r,g,b)$ box). How do I have to change my ColorFunction
accordingly? Or even better: how can I project the colors from the surface of the box above to my two dimensional wedge?
r
,g
, andb
which smoothly go from 1 on one vertex to 0 on the others, then use the colourRGBColor @@ ({r, g, b} / Max[r, g, b])
. $\endgroup$