# Showing variable values on a 3D Plot

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!

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}] Use, PlotLabel -> Row[{"cS = ", cS}] to get • The second code did the trick, thanks! Is there any way though to show the fraction as a decimal? – Joep Aug 10 '18 at 22:16
• @Joep, you can use, for example, PlotLabel -> Row[{"cS = ", Round[cS, .001]}] to show the three digits after the decimal point. – kglr Aug 10 '18 at 22:29
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}
] 