4
$\begingroup$

Please compare the output of these two similar codes:

ListPlot[Table[(n + 2)/(3 n), {n, 1, 50}], AxesOrigin -> {0, 0}, PlotRange -> All]
ListPlot[Table[(2 n + 2)/(3 n), {n, 1, 50}], AxesOrigin -> {0, 0}, PlotRange -> All]

I believe this is a bug. I use Mathematica 10.0.2.

$\endgroup$
4
  • $\begingroup$ looks fine using M9. $\endgroup$
    – penguin77
    Commented Apr 12, 2015 at 13:42
  • 1
    $\begingroup$ Indeed in 10.0.2 x-axis is missing. $\endgroup$
    – Kuba
    Commented Apr 12, 2015 at 13:45
  • 3
    $\begingroup$ a work-around: Show[ListPlot[Table[(2 n + 2)/(3 n), {n, 1, 50}]], AxesOrigin -> {0, 0},PlotRange -> All] $\endgroup$
    – kglr
    Commented Apr 12, 2015 at 14:20
  • $\begingroup$ There can be problems using All for ListPlot. Try using PlotRange -> Full, or AxesOrigin - > {0,Automatic} and not PlotRange -> All, or AxesOrigin - > {0,All} to avoid that problem. $\endgroup$
    – Carl
    Commented Aug 28, 2020 at 16:24

1 Answer 1

2
$\begingroup$

I don't think this is a bug. According to the Help system:

PlotRange -> All ........ all points are included

And in both your plots, all points are included. If you want your custom location for the axes to be included and visible in the plot, then you need to specify this requirement in the PlotRange setting, say:

PlotRange -> {0, All}

For example:

ListPlot[Table[(2 n + 2)/(3 n), {n, 1, 50}], AxesOrigin -> {0, 0}, 
  PlotRange -> {0, All}]

enter image description here

... includes All points, starting the vertical from 0, so that the axes location that you have manually specified are visible.

$\endgroup$
1
  • $\begingroup$ This might be true, but in general, if you have e.g. a plot of Sin[a x] inside Manipulate with a as manipulated parameter, specifying PlotRange will become a nightmare because sometimes you want to use All to prevent clipping the negative part, and sometimes you need to specify 0 to make x axis visible. $\endgroup$
    – Ruslan
    Commented May 4, 2015 at 6:23

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.