Hello, I am trying to change alphabets "a, a, a" in legend boxes to Uppercase A, F and T, but its not working. If someone can please help me.
library(ggplot2)
#> Warning: package 'ggplot2' was built under R version 3.5.3
library(reprex)
#> Warning: package 'reprex' was built under R version 3.5.3
library(tidyverse)
#> Warning: package 'tidyverse' was built under R version 3.5.3
#> Warning: package 'tibble' was built under R version 3.5.3
#> Warning: package 'tidyr' was built under R version 3.5.3
#> Warning: package 'purrr' was built under R version 3.5.3
#> Warning: package 'dplyr' was built under R version 3.5.3
#> Warning: package 'stringr' was built under R version 3.5.3
library(reshape2)
#> Warning: package 'reshape2' was built under R version 3.5.3
#>
#> Attaching package: 'reshape2'
#> The following object is masked from 'package:tidyr':
#>
#> smiths
library(ggrepel)
#> Warning: package 'ggrepel' was built under R version 3.5.3
mydata <-read.table("F:/CATAFileForR.csv", header = T, sep = ",")
#help from community
mds <- cmdscale(1-cor(mydata[, -c(1:2,20)], use = "complete.obs"))
categories <-c("Texture", "Texture", "Texture", "Texture", "Texture",
"Aroma", "Flavor", "Flavor", "Aroma", "Aroma",
"Flavor", "Aroma", "Flavor", "Texture")
mds <- cmdscale(1-cor(mydata[, -c(1:2,20)], use = "complete.obs"))
ggplot(data = as.data.frame(mds), aes(x =mds[,1], y = mds[,2])) +
theme_grey() +
geom_label_repel(aes(label = rownames(mds),fill = factor(categories)), size =3.5,
color = 'white', box.padding = unit(0.45, "lines"), segment.color = 'grey50') +
theme(legend.title = element_blank()) + geom_vline(xintercept=c(0), linetype="dashed") +
geom_hline(yintercept = c(0), linetype="dashed") +
geom_point()
Created on 2020-06-12 by the reprex package (v0.3.0)