`geom_rect()` in `coord_radial()` appearing as perfect rectangles

Hello,

I'm working on translating an old package from lattice to ggplot2.

One function produces plots like this:

Under-the-hood there's a lot of complex trigonometry going on as this plot is actually drawn on cartesian coordinates.

In ggplot2 we can, of course, use coord_radial(), which gets me as far as:

The big difference is that the old plot has perfect rectangles, whereas the new plot expands from the center and curves with the polar axis.

This new plot uses geom_rect() (or could use geom_polygon() - both appear to work simialrly).

A potential solution is to use geom_segment() with some really thick linewidths, which gets me something very similar:

However because each segment is itself a line, I can't add a border to the rectangles.

So, is there a way to tick the following two boxes?

  • perfect rectangles despite being on a polar coordinate (works with geom_segment, doesn't work with geom_rect)
  • ability to add a border colour (works with geom_rect, doesn't work with geom_segment).

(This is a bit of a plotting edge case, but we'd like to follow the convention of wind rose-type plots to have these boxy rectangles rather than curved shapes)

Cheers!