8
$\begingroup$

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

$\endgroup$
2
  • 1
    $\begingroup$ 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/… $\endgroup$
    – MikeY
    Commented Mar 3, 2020 at 15:03
  • $\begingroup$ Perhaps the use of Quanterions would be helpful? $\endgroup$ Commented Mar 5, 2020 at 0:33

1 Answer 1

6
$\begingroup$

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

enter image description here

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

enter image description here

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

enter image description here

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

enter image description here

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}]
$\endgroup$
5
  • 1
    $\begingroup$ Perhaps the 5th dimension could be the opacity? or the saturation of the color? 3-space dimensions, 1 hue, 1 opacity/saturation? $\endgroup$
    – SHuisman
    Commented Mar 4, 2020 at 21:49
  • 1
    $\begingroup$ @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? $\endgroup$ Commented Mar 4, 2020 at 22:47
  • $\begingroup$ What is f is just a list, or complex number? $\endgroup$
    – SHuisman
    Commented Mar 4, 2020 at 23:08
  • $\begingroup$ @SHuisman f is the value of a function fed into a plotting function. in dcos in details look at the first section. $\endgroup$ Commented Mar 4, 2020 at 23:10
  • $\begingroup$ Thanks it is what I was looking for. $\endgroup$
    – mattiav27
    Commented Mar 5, 2020 at 6:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.