3
$\begingroup$

Mathematica chooses the PlotRange for a ListPlot such that the lowest x-value lies on the y-axis and vice versa. Because of this these points often are difficult to find. I could increase the dot size, but then a listplot easily becomes messy.

Isn't there some kind of zoom-out function or parameter which increases the limits of both plotranges? I tried ImagePadding, but that adds a padding around the full plot, including the axes.

$\endgroup$
6
  • 2
    $\begingroup$ PlotRangePadding? $\endgroup$
    – kglr
    Feb 4, 2015 at 12:18
  • $\begingroup$ @kguler - I almost felt embarrassed that I didn't find that, but it doesn't do the trick: the points remain on the axes. Oddly, in the help file example it does exactly what I want. Thanks for your reply, anyway. $\endgroup$
    – stevenvh
    Feb 4, 2015 at 12:20
  • $\begingroup$ You can set the x and y ranges both with PlotRange->{{xmin,xmax},{ymin,ymax} $\endgroup$
    – Jason B.
    Feb 4, 2015 at 12:24
  • $\begingroup$ @steven, you probably need to play with AxesOrigin too. $\endgroup$
    – kglr
    Feb 4, 2015 at 12:24
  • $\begingroup$ Steven, nice to see you posting again. :-) $\endgroup$
    – Mr.Wizard
    Feb 4, 2015 at 13:29

1 Answer 1

4
$\begingroup$

I propose using PlotRangePadding and a partial Frame in place of axis lines:

ListPlot[Prime @ Range @ 25,
 PlotRangePadding -> Scaled[0.1],
 Axes -> False, 
 Frame -> {True, True, False, False}
]

enter image description here

$\endgroup$
6
  • $\begingroup$ Clever! Thanks a bunch. (I knew you would be here :-)) $\endgroup$
    – stevenvh
    Feb 4, 2015 at 14:51
  • $\begingroup$ @steven You're welcome. How are you? $\endgroup$
    – Mr.Wizard
    Feb 4, 2015 at 14:57
  • $\begingroup$ Fine, thanks. Not very much mathematica for the moment, and active in electronics, but not on stackexchange for the moment. Olin must have taken my #1 position long ago already :-) $\endgroup$
    – stevenvh
    Feb 4, 2015 at 15:19
  • $\begingroup$ It seems the "Axes->False" isn't required; apparently the Frame parameter switches off axes automagically. $\endgroup$
    – stevenvh
    Feb 5, 2015 at 9:09
  • $\begingroup$ @stevenvh In version 10 it is required; without it I get: i.stack.imgur.com/aYBHb.png $\endgroup$
    – Mr.Wizard
    Feb 5, 2015 at 10:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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