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

2023-10-08 Thread Jeff Newmiller via R-help
Ah, I accidentally replied only to you. I re-introduced the list here... Maybe this [1] will help? [1] https://coolbutuseless.github.io/2021/11/04/custom-ggplot2-point-shapes-with-gggrid/ On October 8, 2023 1:04:23 AM PDT, Chris Evans wrote: > >On 07/10/2023 17:45, Jeff Newmiller wrote: >>

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

2023-10-07 Thread Chris Evans via R-help
SO helpful. Thanks to all.  I _think_ the answer to Jeff's question may be "It should only be problematical on R earlier than 2.10". At least, that's how I read this: There is a portable way to have arbitrary text in character strings (only) in your R code, which is to supply them in Unicode

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

2023-10-06 Thread Jeff Newmiller via R-help
Doesn't the outcome of this suggestion still depend on which fonts and output device you are using? ... and that is to some degree still system dependent... On October 6, 2023 7:50:00 AM PDT, Rui Barradas wrote: >Às 10:09 de 06/10/2023, Chris Evans via R-help escreveu: >> The reason I am asking

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

2023-10-06 Thread Rui Barradas
Às 10:09 de 06/10/2023, Chris Evans via R-help escreveu: The reason I am asking is that I would like to mark areas on a plot using geom_polygon() and aes(fill = variable) to fill various polygons forming the background of a plot with different colours. Then I would like to overlay that with

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

2023-10-06 Thread Jan van der Laan
Another thing that I considered, but doesn't seem to be supported, is rotating the symbols. I noticed that that does work with text. So you could use a arrow symbol and then specify the angle aesthetic. But this still relies on text and unfortunately there are no arrowlike symbols in ASCII:

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

2023-10-06 Thread Chris Evans via R-help
Thanks again Jan.  That is lovely and clean and I probably should have seen that option. I had anxieties about the portability of using text.  (The function will end up in my https://github.com/cpsyctc/CECPfuns package so I'd like it to be fairly immune to character sets and different

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

2023-10-06 Thread Jan van der Laan
You are right, sorry. Another possible solution then: use geom_text instead of geom_point and use a triangle shape as text: ggplot(data = tmpTibPoints, aes(x = x, y = y)) + geom_polygon(data = tmpTibAreas, aes(x = x, y = y, fill = a)) + geom_text(data = tmpTibPoints,

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

2023-10-06 Thread Chris Evans via R-help
Sadly, no.  Still shows the same legend with both sets of fill mappings.  I have found a workaround, sadly much longer than yours (!) that does get me what I want but it is a real bodge.  Still interested to see if there is a way to create a downward pointing solid symbol but here is my bodge

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

2023-10-06 Thread Jan van der Laan
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,