Why it is said that stroke aesthetic works on shape 21-24 only?

Viewed 41

If stroke is the size of the borders of 25 built-in shapes in R, logically it should work on every shape (we can exclude filled shapes 15 to 20).

ggplot ()+ geom_point(mapping=aes(x=1:5, y=1:5), shape=12, size=7)

This is a graph without stroke

ggplot ()+ geom_point(mapping=aes(x=1:5, y=1:5), shape=12, stroke=2, size=6)

This is a graph with stroke

So it seems to me that stroke works on shapes 0-14 too. Can anyone explain this, please?

1 Answers
ggplot(data.frame(a = 0:25, stroke = rep(0:2, each = 26)),
       aes(x = a, y = as.character(stroke), shape = a, stroke = stroke)) +
  geom_point(size = 3, color = "red", fill = "blue") +
  scale_shape_identity()

Stroke impacts every shape, but the effect is much more obvious on 0-14 and 21-25. 21-25 are the shapes where stroke will be most useful in balancing the relative visual prominence of the outline color (defined by "color") and the interior (defined by "fill").

We can observe three groups of shape behaviors:

  • 0-14 are created by lines whose thickness is controlled by stroke (becoming invisible when stroke is 0) and whose color is controlled by "color." The strokes have round corners.

  • 15-20 have both an interior and an outline that is impacted by stroke (though less and differently than the others; note that triangle 17 retains sharp corners with larger stroke width, while 2 and 24 do not). Both the interior and line color are controlled by "color."

  • 21-15 have both an interior and an outline that is impacted by stroke. "Color" defines the stroke color and "fill" defines the interior color. The strokes have round corners.

enter image description here

Related