Fully customizing ggplot2 axis lines

Hi everyone,

I am creating a ggplot2 theme but I want that my axis lines look like this:

As you can see it's a very minimalist design: just a straight line with downward bars at each end.

The closest I know is the theme_classic() theme, but it's still very different. I searched the ggplot2 book by Hadley, Navarro, Petersen but didn't find anything useful. I haven't found anything useful on the element_line() function either inside the theme() function.

Can anyone point me in the right direction?

Thank you in advance!

You may find the lemon package useful.

library(ggplot2)

p = qplot(iris$Sepal.Length, iris$Petal.Length) + 
  theme_classic() +
  theme(panel.border=element_blank(), 
        axis.line=element_line())

p

p + lemon::coord_capped_cart(bottom = "both", left = "both")

Created on 2021-12-31 by the reprex package (v2.0.1)

Thank you Jack! This could work but I'm looking for a more customizable solution. I'd like to know how to customize a theme, such as the xkcd theme , for example.