Triangle symbol in R how is it written

78 Views Asked by At

I'm very new to r I'm working on ggplot2, Boxplot to be specific So my plot have a sample name as character and values as numbers I'm trying to label the x-axis with my samples name and each name has a triangle symbol next to it. This symbol represent the meaning of full gene deletion in the genomic DNA.

for example:

sample 1: bres(triangle symbol) sample 2: west(triangle symbol)

Is there a function in r for this symbol? What is the triangle symbol named in R? How do I write the code for that? Also how do I write my samples name as italic?

I searched and I couldn't find anyone who experienced this issue as well

1

There are 1 best solutions below

3
Stéphane Laurent On

You can use unicode characters:

dat <- data.frame(
  sample = rep(c("bres", "west"), 4),
  y = rnorm(8)
)

ggplot(dat, aes(sample, y)) + geom_boxplot() +
  scale_x_discrete(labels = c("bres \u25b2", "west \u25b3"))

enter image description here