[R] Is it possible to get a downward pointing solid triangle plotting symbol in R?

Jan van der Laan rhe|p @end|ng |rom eoo@@dd@@n|
Fri Oct 6 11:50:21 CEST 2023


Does adding

, show.legend = c("color"=TRUE, "fill"=FALSE)

to the geom_point do what you want?

Best,
Jan

On 06-10-2023 11:09, Chris Evans via R-help wrote:
> library(tidyverse)
> tibble(x = 2:9, y = 2:9, c = c(rep("A", 5), rep("B", 3))) -> tmpTibPoints
> tibble(x = c(1, 5, 5, 1), y = c(1, 1, 5, 5), a = rep("a", 4)) -> 
> tmpTibArea1
> tibble(x = c(5, 10, 10, 5), y = c(1, 1, 5, 5), a = rep("b", 4)) -> 
> tmpTibArea2
> tibble(x = c(1, 5, 5, 1), y = c(5, 5, 10, 10), a = rep("c", 4)) -> 
> tmpTibArea3
> tibble(x = c(5, 10, 10, 5), y = c(5, 5, 10, 10), a = rep("d", 4)) -> 
> tmpTibArea4
> bind_rows(tmpTibArea1,
>            tmpTibArea2,
>            tmpTibArea3,
>            tmpTibArea4) -> tmpTibAreas
> ggplot(data = tmpTib,
>         aes(x = x, y = y)) +
>    geom_polygon(data = tmpTibAreas,
>                 aes(x = x, y = y, fill = a)) +
>    geom_point(data = tmpTibPoints,
>               aes(x = x, y = y, fill = c),
>               pch = 24,
>               size = 6)



More information about the R-help mailing list