1
$\begingroup$

I am running a 3D plot a 100 times to show the dynamics of two undetermined variables (cM and cR) for a 100 values of cS, using the following command:

Table[
 Plot3D[
  CentralizationBenefitSharingGraph[cM, cR, cS]
  , {cM, 0, 1}
  , {cR, 0, 1}
  , ViewPoint -> Above
  , PlotRange -> Automatic
  , AxesLabel -> Automatic
  , PlotLegends -> "Expressions"
  , ColorFunction -> (If[#3 > 0, Green, Red] &)
  , ColorFunctionScaling -> False
  , PlotPoints -> 100
  , FaceGrids -> {{0, 1, 0}, {0, 0, -1}, {1, 0, 0}}
  , FaceGridsStyle -> Black
  , AxesStyle -> Thick
  , BoxStyle -> Thick
  ]
 , {cS, 0, 1, 1/100}
 ]

Awfully long, sorry about that. What I am trying to do, however, is show the corresponding value of the variable cS in every plotted graph, so that I won't have to manually add them a hundred times.

Any help is much appreciated, thanks!

$\endgroup$

2 Answers 2

1
$\begingroup$

You can use the option PlotLabel:

Table[Plot3D[Sin[(cM + cR + cS) 2 Pi], {cM, 0, 1}, {cR, 0, 1}, 
  ViewPoint -> Above, PlotRange -> Automatic, AxesLabel -> Automatic, 
  PlotLabel -> (HoldForm[Sin[(cM + cR + z) 2 Pi]] /. z -> cS), 
  ColorFunction -> (If[#3 > 0, Green, Red] &), 
  ColorFunctionScaling -> False, PlotPoints -> 100, 
  FaceGrids -> {{0, 1, 0}, {0, 0, -1}, {1, 0, 0}}, 
  FaceGridsStyle -> Black, AxesStyle -> Thick, 
  BoxStyle -> Thick], {cS, 0, 1, 1/3}]

enter image description here

Use, PlotLabel -> Row[{"cS = ", cS}] to get enter image description here

$\endgroup$
2
  • $\begingroup$ The second code did the trick, thanks! Is there any way though to show the fraction as a decimal? $\endgroup$ Commented Aug 10, 2018 at 22:16
  • $\begingroup$ @Joep, you can use, for example, PlotLabel -> Row[{"cS = ", Round[cS, .001]}] to show the three digits after the decimal point. $\endgroup$ Commented Aug 10, 2018 at 22:29
0
$\begingroup$
Manipulate[
 Row@{
   Plot3D[
    Exp[-((cM + cR)/(0.1 + cS))^2]
    , {cM, 0, 1}
    , {cR, 0, 1}
    , ViewPoint -> Above
    , PlotRange -> Automatic
    , AxesLabel -> Automatic
    , PlotLegends -> "Expressions"
    , ColorFunction -> (If[#3 > 0, Green, Red] &)
    , ColorFunctionScaling -> False
    , PlotPoints -> 100
    , FaceGrids -> {{0, 1, 0}, {0, 0, -1}, {1, 0, 0}}
    , FaceGridsStyle -> Black
    , AxesStyle -> Thick
    , BoxStyle -> Thick
    , PlotLabel -> StringTemplate["cS: ``"]@cS
    , ImageSize -> 400
    ],
   VerticalGauge[cS, {0, 1}]
   }
 , {cS, 0, 1}
 ]

enter image description here

$\endgroup$

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.