2
$\begingroup$

In the documentation for PlotRange, there is the following line:

  • If a particular minimum or maximum is specified as {Automatic, α}, this means that the range should in effect be cut off beyond a fraction $α$ of points in the plot. When smooth curves or surfaces are plotted, the measure of points is based on projected length or area.

I would like to use this option to cut off, say, 10 percent of the points in a ListPlot. I am aware that ListPlot's default PlotRange -> Automatic option does cut off a fraction of the points, but I would like to control how many points are cut off. However, whenever I try to use the pair {Automatic, 0.1} in place of a coordinate's maximum or minimum I get the following error:

Value of option PlotRange -> (*PlotRange specification*) is not All, Full, Automatic, 
a positive machine number, or an appropriate list of range specifications.

Am I misunderstanding or incorrectly applying the documentation here, or is there an actual error in the documentation here?

$\endgroup$
4
  • 1
    $\begingroup$ I'm just as confused by the docs as you are. It's either a bug or bad wording. $\endgroup$
    – N.J.Evans
    Jun 19, 2015 at 17:15
  • $\begingroup$ I agree: I had not noticed that part of the documentation before, but I do interpret it as OP did. I have been playing around with it a bit, but I can't seem to do anything more than setting explicit PlotRanges when using the suggested syntax... Strange. $\endgroup$
    – MarcoB
    Jun 19, 2015 at 18:55
  • $\begingroup$ is is bad wording regardless of whether its also bug ( or an abandoned feature perhaps? ). Liam, can you include an example of the actual syntax you tried that produces that error in the question. $\endgroup$
    – george2079
    Jun 20, 2015 at 13:25
  • $\begingroup$ Here's an example of syntax which gave the aforementioned error: ListPlot[Table[{n, Exp[-n] Sin[n]}, {n, 1, 10}], PlotRange -> {{0, 10}, {{Automatic, 0.1}, {Automatic, 0.2}}}] $\endgroup$
    – Liam Baker
    Jun 25, 2015 at 20:50

1 Answer 1

1
$\begingroup$
mydata = Table[RandomReal[], {100}]

If you want to cut off the top .1 and bottom .1 of the data, just use the proper quantiles:

ListPlot[mydata,
 PlotRange -> Quantile[mydata, {.1, .9}]]

or interactively...

Manipulate[
 ListPlot[mydata,
  PlotRange -> Quantile[mydata, {i, 1 - i}]
  ], {i, 0, .5}]
$\endgroup$
1
  • $\begingroup$ As far as I can tell, your first option chooses an automatic value for the minimum y value, and sets 0.5 as the maximum value... And your second option clips the data from (ymin,ymax) to (ymin+0.3,ymax-0.3) instead of cutting off 30% of the points. But thank you! $\endgroup$
    – Liam Baker
    Jun 19, 2015 at 15:48

Your Answer

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

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