Skip to content

geom_tile borders missing notch at top left corners #3037

Closed
@DanielReedOcean

Description

@DanielReedOcean

This is an issue that has been discussed over at Stackoverflow. The original problem can be found here. A minimal reprex is included below.

I have the following data frame:

# Dummy data frame
df <- expand.grid(x = 1:3, y = 1:3)

I would like to plot it as a geom_tile using ggplot2 like so:

# Tile plot
ggplot(df) + 
  geom_tile(aes(x = x, y = y), 
            fill = NA, colour = "red", size = 3, width = 0.7, height = 0.7)

which gives,

rplot

Notice that in the top left corner of each tile the border has a notch missing and that the corner doesn't dovetail nicely like the other corners. The outcome I expected was a square around each tile, perhaps something like this:

rplot01

A solution offered here by Z. Lin in that Stackoverflow thread suggests that linejoin and lineend for geom_tile are switched to mitre and square, respectively. Or, that they are at least offered as parameters in the geom so that the user can choose for themselves. Hopefully, this demonstrates my issue adequately, but please let me know if I can clarify any aspect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions