How to avoid clipping points at plot boundaries?

Hi there,

I have defined axis limits such that I have ticks at the boundaries of my plot. But data points whose values correspond to the limits are clipped at the plot boundaries. In R, one can prevent this by using coord_cartesian(clip="off"). Is there an equivalent in Julia / GR ? Many thanks in advance.

Adding the plot argument widen=true is not satisfactory?

1 Like

Then the axes don’t end at a tick :frowning: In other words: I only want to manipulate the limitations of where the data can be drawn (called plot area in Plots.jl?), such that I have full circles when plotting data points, while keeping axis limits.

Then you may need to change package as in this example.

1 Like

Good suggestion, but switching backend entails a lot of changes to be made. I guess I will simply adjust lims, export the plot as SVG and correct the axis extension in Inkscape.

Before we throw in the towels with Plots gr() back-end, some possible workaround:

using Plots; gr()
rectangle(w, h, x, y) = Shape(x .+ [0,w,w,0], y .+ [0,0,h,h])
xl = (-3, 3)
yl = (-1, 1)
plot(rectangle(xl[2]-xl[1],yl[2]-yl[1],xl[1],yl[1]), opacity=.1, grid=true, legend=false)
scatter!(sin, xlims=xl, ylims=yl, tick_direction=:out, framestyle=:grid, widen=true)
1 Like

Layering seems like a good approach. I will look into this (again).