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.

I have a list of numbers and I want to plot the fraction of numbers >= k against k which will naturally be a decreasing curve. How do I do that?

share|improve this question
add comment

3 Answers 3

E.g.:

test = RandomInteger[100, 100];

ListLinePlot[With[{r = Reverse@Sort@Tally[test]}, 
  Transpose[{Reverse@r[[All, 1]], Reverse@Accumulate@r[[All, 2]]}]]]

enter image description here

share|improve this answer
add comment

You mean something like this?

list = RandomVariate[BinomialDistribution[100, 0.1], {10000}];

You can use list to construct an EmpiricalDistribution, and then use DiscretePlot (if the list is all integers) or Plot (if it's reals) to plot the complement of its CDF.

dist = EmpiricalDistribution[list];

DiscretePlot[1 - CDF[dist, x], {x, 0, 100}, PlotRange -> All]

plot of CDF's complement

share|improve this answer
add comment

Few more alternatives/variations:

data = RandomReal[50, 100];
(* HistogramList with height spec "SF" *)
ListLinePlot[#, PlotRange -> {{0, 60}, Automatic}] &@
     Thread@PadRight@HistogramList[data, 1000, "SF"]
(* SurvivalFunction and EmpiricialDistribution *)
Plot[SurvivalFunction[EmpiricalDistribution[data], x], {x, 0, 60}, Exclusions -> None]
(* Plain old Histogram with height spec "SF" *)
Histogram[data, 1000, "SF", PlotRange -> {{0, 60}, Automatic}];

enter image description here

share|improve this answer
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.