Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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"}]
share|improve this question
add comment

1 Answer

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

share|improve this answer
    
Great - Show, and Epilog are new to me. What is the N@10^-8 term for? to avoid zero? thanks, Fred –  Fred Schenkelberg Apr 27 '13 at 16:57
    
@FredSchenkelberg Yep, just to avoid the zero –  belisarius Apr 27 '13 at 17:04
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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