Example code:
library(ggplot2)
b<- ggplot(mtcars, aes(wt, mpg)) df<-data.frame(x1= c(2.62, 2.62), x2= c(3.57,2.62), y1= c(21,21), y2= c(21, 16))
b+ geom_segment(aes(x=x1, y=y1, xend=x2, yend=y2, colour="segment"), data=df, size=2, lineend="square")
library(plotly)
ggplotly()
Here is how the corner looks in ggplots2:

And in ggplotly:

Notice the "notch" in the corner...
Example code:
Here is how the corner looks in ggplots2:

And in ggplotly:
Notice the "notch" in the corner...