 <p>Okay, here is a first pass - doing it in <code>grid</code>. This could be done in <code>ggplot2</code> too I imagine, but I want to learn grid for now since ggplot2 and lattice are based on it. This plot has some issues, for example the angle of the annotation text really has to be calculated in device coordinates, not native coordinates, so it only looks right if your grid squares are really square. I might fix that later, but I don't have time now. Also I would think I could specify the defaults so that each primitive doesn't have that <code>default.units</code> parameter. This should get you started though.</p> <pre><code>library(grid) grid.newpage() df &lt;- data.frame(a=c(2,3,4,5,6,7),b=c(3,7,8,9,2,1)) vp &lt;- viewport(x=0.5,y=0.5,width=0.999,height=0.999,xscale=c(0,1),yscale=c(0,1)) pushViewport(vp) # a rectangle (with dashed lines) on the border of the viewport: grid.rect(gp=gpar(lty="dashed",col="steelblue")) vp &lt;- viewport(x=0.5,y=0.5,width=0.9,height=0.9,xscale=c(0,8),yscale=c(0,10), default.units="native") pushViewport(vp) #draw the background grid grid.polyline(x=rep(0:8,each=2),y=rep(c(0,10),9),id=rep(1:9,each=2), gp=gpar(lty="solid",col="gray"),default.units="native") grid.polyline(x=rep(c(0,8),11),y=rep(0:10,each=2),id=rep(1:11,each=2), gp=gpar(lty="solid",col="gray"),default.units="native") # add the lables grid.text(as.character(0:8),x=0:8,y=rep(-0.2,9), gp=gpar(col="gray",fontsize=12),default.units="native") grid.text(as.character(0:10),y=0:10,x=rep(-0.2,11), gp=gpar(col="gray",fontsize=12),default.units="native") grid.lines(x=df$a,y=df$b,gp=gpar(col="steelblue"),default.units="native") grid.points(x=df$a,y=df$b,gp=gpar(col="steelblue"),default.units="native") for (i in 1:(nrow(df)-1)){ x0 &lt;- df$a[i] y0 &lt;- df$b[i] x1 &lt;- df$a[i+1] y1 &lt;- df$b[i+1] dx &lt;- x1-x0 dy &lt;- y1-y0 dist &lt;- sqrt( dx^2 + dy^2 ) ang &lt;- (180/3.14159)*atan2(dy,dx) txt &lt;- sprintf("D: %.1f Ang:%.1f",dist,ang) xt &lt;- (x0+x1)/2 yt &lt;- (y0+y1)/2 + 0.2*abs(dy/dx) grid.text(txt,x=xt,y=yt,rot=ang, gp=gpar(col="steelblue",fontsize=9),default.units="native") } </code></pre> <p><img src="https://i.stack.imgur.com/8MekL.png" alt="enter image description here"></p>