# Plot a 5 dimensional quantity

I have to plot a function of four angles $$\alpha,\beta,\gamma,\delta$$ all of which vary from 0 to $$\pi$$; the function is simply:

Cos[α] Cos[β] + Cos[γ] Cos[δ]


I am thinking of something like the plot shown in this site, with the projection on one coordinate and a ContourPlot between the two, something similar to the plots in this answer. If I had a 3D function I could use for example PointOfView to project on one coordinate, but I have a 5D quantity and I am lost.

I am using version 10.0

• Parallel coordinates can be a mechanism to show higher dimension data. It all depends on the data and what you are trying to see. Here's a parallel coordinates solution. mathematica.stackexchange.com/questions/207054/… – MikeY Mar 3 '20 at 15:03
• Perhaps the use of Quanterions would be helpful? – morbo Mar 5 '20 at 0:33

Everywhere below I use a rescaled by Pi version with variable ranges $$[0,1]$$ -- it easier to understand it on the plots:

Cos[Pi a]Cos[Pi b]+Cos[Pi g]Cos[Pi d]


## 3D + color + tabulation You can make usage of DensityPlot3D that gives you 4D plotting (3 axes and 4th color variable) and then run remaining 5th variable through a range of values. This code will give you the top image (explore options of DensityPlot3D to adapt to your needs):

Multicolumn[
Table[
DensityPlot3D[
Cos[Pi a]Cos[Pi b]+Cos[Pi g]Cos[Pi d],
{a,0,1},{b,0,1},{g,0,1},
PlotLabel->"d = Pi*"<>ToString[N[d,2]],
ColorFunction->"TemperatureMap",
PlotTheme->"Detailed",
PlotLegends->None],
{d,0,1,1/15}]
,4]


## 3D + color + tabulation This one is a bit unorthodox, but I just love the look of it.

Multicolumn[
Table[
SliceContourPlot3D
[Cos[Pi a]Cos[Pi b]+Cos[Pi g]Cos[Pi d],
{"CenterCutSphere",Pi/2,0},
{a,0,1},{b,0,1},{g,0,1},
ViewPoint->{2.4,-0.6,2.3},
Boxed->False,
Axes->False,
Contours->15,
Method->{"ShrinkWrap"->True}],
{d,0,1,1/8}],
4]


## 3D + color + tabulation One more take on this...

Multicolumn[
Table[
SliceContourPlot3D
[Cos[Pi a]Cos[Pi b]+Cos[Pi g]Cos[Pi d],
{"ZStackedPlanes",4},
{a,0,1},{b,0,1},{g,0,1},
RegionFunction->Function[{x,y,z},x<1/2||y>1/2],
Contours->15,
PlotTheme->"Detailed",
PlotLegends->False,
Method->{"ShrinkWrap"->True}],
{d,0,1,1/8}],
4]


## 3D + multi-surface + animation Alternatively you can use Plot3D surface for 3D, table of surfaces for the 4th, and animation for the 5th parameter. Here is the code for the animation above:

Manipulate[
Plot3D[
Table[Cos[Pi a]Cos[Pi b]+Cos[Pi g]Cos[Pi d],{b,0,1,1/2}],
{a,0,1},{g,0,1},
PlotPoints->15,
SphericalRegion->True,
ImageSize->{400,400},
Mesh->10,
MeshStyle->Opacity[.5],
BoxRatios->1,
ColorFunction->"Rainbow",
AxesLabel->{a,g,f}],
{d,0,1}]

• Perhaps the 5th dimension could be the opacity? or the saturation of the color? 3-space dimensions, 1 hue, 1 opacity/saturation? – SHuisman Mar 4 '20 at 21:49
• @SHuisman nice idea but ...actually I am not sure how to pass the 5th one to anything internal of a plot. For instance ColorFunction will take only x,y,z,f values and the 5th one is just a parameter --- not sure how to pass it inside of a plot. Any ideas? – Vitaliy Kaurov Mar 4 '20 at 22:47
• What is f is just a list, or complex number? – SHuisman Mar 4 '20 at 23:08
• @SHuisman f is the value of a function fed into a plotting function. in dcos in details look at the first section. – Vitaliy Kaurov Mar 4 '20 at 23:10
• Thanks it is what I was looking for. – mattiav27 Mar 5 '20 at 6:35