ggplot2 icon indicating copy to clipboard operation
ggplot2 copied to clipboard

Additional `arrow.fill` parameters for line-based functions.

Open teunbrand opened this issue 4 months ago • 0 comments

This PR aims to fix #5658.

Briefly, an arrow.fill parameter was either added or propagated in these functions:

  • geom_path() and thus by extension geom_line()
  • geom_function()
  • geom_sf() when drawing line geometries
  • element_line()

A demonstration of each of these:

devtools::load_all("~/packages/ggplot2")
#> ℹ Loading ggplot2

my_arrow <- arrow(angle = 20, type = "closed")

ggplot(pressure, aes(temperature, pressure)) +
  geom_line(arrow = my_arrow, arrow.fill = "red")


ggplot() +
  geom_function(
    fun = dnorm, xlim = c(-2, 2), 
    arrow = my_arrow, arrow.fill = "red"
  )


ggplot(sf::st_linestring(as.matrix(pressure))) +
  geom_sf(arrow = my_arrow, arrow.fill = "red")


ggplot(mpg, aes(displ, hwy)) +
  geom_point() +
  theme(
    axis.line = element_line(arrow = my_arrow, arrow.fill = "red")
  )

Created on 2024-03-11 with reprex v2.1.0

teunbrand avatar Mar 11 '24 14:03 teunbrand