If anyone has any idea how to turn all of that plotting stuff (hcpii4plot
) into a function which takes hcpii4angfunc[\[Theta], \[Phi]]
as an argument, that would make my notebook a lot neater and easier to read. I have been struggling with this for a couple of months now and couldn't find how to do it anywhere online...
hcpii4angfunc[\[Theta]_, \[Phi]_] = -1.1619488688971678` +
0.8938068222285906` Cos[2 \[Theta]] +
3.1283238778000673` Cos[2 \[Theta]]^2
hcpii4plot =
SphericalPlot3D[1, {\[Theta], 0, \[Pi]}, {\[Phi], 0, 2 \[Pi]},
ColorFunction ->
Function[{x, y, z, \[Theta], \[Phi], r},
ColorData["DarkRainbow"][hcpii4angfunc[\[Theta], \[Phi]]]],
ColorFunctionScaling -> False, Mesh -> False, Boxed -> False,
AxesOrigin -> {0, 0, 0},
PlotRange -> {{-1.3, 1.3}, {-1.3, 1.3}, {-1.22, 1.22}},
LabelStyle -> Directive[Black, 14], Ticks -> None,
AxesStyle -> Arrowheads[{-0.05, 0.05}],
Method -> {"ShrinkWrap" -> True}, ViewPoint -> {-2, -2, 1},
ViewVertical -> {1, 1, 1}];
Graphics[Inset[hcpii4plot, Center, Center, ImageScaled[1]],
Epilog -> {Text[Style["x", FontSize -> 20],
ImageScaled[{0.03, .33}]],
Text[Style["y", FontSize -> 20], ImageScaled[{.97, .33}]],
Text[Style["z", FontSize -> 20], ImageScaled[{.5, .99}]]}]
BarLegend[{"DarkRainbow", {MinValue[
hcpii4angfunc[\[Theta], \[Phi]], {\[Theta], \[Phi]}],
MaxValue[hcpii4angfunc[\[Theta], \[Phi]], {\[Theta], \[Phi]}]}},
LegendLayout -> "Row", LabelStyle -> Directive[Black, 14]]
Any help would be greatly appreciated!