tidyverse/ggplot2

Could `geom_bar`/`geom_col`/`geom_histogram` support `outline.type = "horseshoe"`?

Closed this issue · 2 comments

Currently in geom_bar/col/histogram, any colour outline is provided in full around the full polygon.

This can sometimes look a little messy with the geoms up against an axis line.

I notice in geom_bar/col/histogram there is a outline.type argument.

It'd be nice if there was an outline.type argument in geom_bar/col/histogram that defaults to "full" but could be changed to "horseshoe".

Ideally, the outline.type = "horseshoe" would adjust depending on the orientation of the plot.

So where normal orientation = "x", outline.type = "horseshoe" would not outline on the bottom of the polygon.

But with a orientation = "y", outline.type = "horseshoe" would not outline on the left of the polygon.

library(tidyverse)

palmerpenguins::penguins |>
  ggplot() +
  geom_bar(
    aes(x = species),
    colour = "red",
    linewidth = 1,
  ) +
  theme_classic() +
  scale_y_continuous(expand = c(0, 0)) +
  coord_cartesian(clip = "off")

Created on 2025-09-04 with reprex v2.1.1

This may make for a nice extension.
Though I'd argue something like sides = "t"/"r"/"b"/"l" is more flexible, so that in your example you'd be able to use sides = "trl" to draw the outline everywhere but the bottom.

Just thought outline.type argument name would be good for keeping the api consistent to how it works in area/density/ribbon