1
$\begingroup$

How to add a slider for the x-axis that shows the value of the y-axis based on the position of the slider.

Basically providing the result of the probably given a specific lot percent defective, lpd value.

I can calculate the value and when I use Column the calculation doesn't respond to changes in the plot's manipulated changes. If I put the calculation within the manipulate plot line - it shows and formatting is pretty hard to read.

Manipulate[
 Plot[N[Probability[x<=c, x \[Distributed] PoissonDistribution[SampleSize *lpd]]], {lpd,0,.1},
  PlotRange -> {0, 1}, Filling -> Axis],
 {SampleSize, 50, 1000, Appearance -> "Labeled"},
 {c, 0, 10, 1, Appearance -> "Labeled"}]
$\endgroup$

1 Answer 1

2
$\begingroup$
f[c_, lpd_, SampleSize_] := Probability[x <= c, Distributed[x , 
                                                      PoissonDistribution[SampleSize*lpd]]]; 
Manipulate[Show[
   Plot[f[c, lpd, SampleSize], {lpd, 0, .1}, PlotRange -> {0, 1}, 
        Filling -> Axis, Epilog -> Inset[Framed[Style[{point, f[c, point, SampleSize]}, 20], 
                                        Background -> LightYellow], Automatic, Automatic]], 
   Graphics[{PointSize[Large], Red, Point[{point, f[c, point, SampleSize]}]}]],

 {SampleSize, 50, 1000, Appearance -> "Labeled"}, 
 {c, 0, 10, 1, Appearance -> "Labeled"},
 {point, N@10^-8, .1, Appearance -> "Labeled"}]

enter image description here

$\endgroup$
2
  • $\begingroup$ Great - Show, and Epilog are new to me. What is the N@10^-8 term for? to avoid zero? thanks, Fred $\endgroup$ Apr 27, 2013 at 16:57
  • $\begingroup$ @FredSchenkelberg Yep, just to avoid the zero $\endgroup$ Apr 27, 2013 at 17:04

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.