4
$\begingroup$

I was trying to plot the points in front of the axes but I could not find a solution. I tried "Method -> {"AxesInFront" -> False}" but it didn't work in ListPlot function. Thanks for sharing your suggestions!

 ListPlot[{{1000, 0}, {2000, 1}, {3000, 0}}, 
 PlotStyle -> PointSize[0.1], ImageSize -> {300, 300}, 
 AspectRatio -> 1, PlotRange -> {{800, 3100}, {-0.03, 1.3}}, 
 Ticks -> {{1000, 2000, 3000}, {}}, LabelStyle -> Directive[14], 
 PlotRangeClipping -> False]

enter image description here

$\endgroup$

1 Answer 1

6
$\begingroup$
lp = ListPlot[{{1000, 0}, {2000, 1}, {3000, 0}}, 
   PlotStyle -> PointSize[0.1], ImageSize -> {300, 300}, 
   AspectRatio -> 1, PlotRange -> {{800, 3100}, {-0.03, 1.3}}, 
   Ticks -> {{1000, 2000, 3000}, {}}, LabelStyle -> Directive[14], 
   PlotRangeClipping -> False];

1.

Easiest approach is to wrap lp with Show with the option Method -> {"AxesInFront" -> False}:

Show[lp, Method -> {"AxesInFront" -> False}]

enter image description here

2.

Use the primitives from lp as Epilog in Show:

Show[lp, Epilog -> lp[[1]]]

enter image description here

3.

Inject the option Method -> {"AxesInFront" -> False} using MapAt:

MapAt[Prepend[#, Method -> {"AxesInFront" -> False}] &, lp, {2}] 

enter image description here

4.

Use Graphics with the option Method -> {"AxesInFront" -> False} using the graphics primitives and options from lp (that is, lp[[1]] and lp[[2]]):

Graphics[lp[[1]], Method -> {"AxesInFront" -> False}, lp[[2]]]

enter image description here

$\endgroup$
1
  • $\begingroup$ Thanks bro! Your solution works perfectly! $\endgroup$
    – Frankie
    Mar 15, 2020 at 13:49

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.