Color Name in R

Author
Affiliation

Somsak Chanaim

International College of Digital Innovation, CMU

Published

August 28, 2024

Color in R

Code
library(ggplot2)
library(plotly)
color_name <-colors()
x <- c(rep(1:25,26),1:7)
y<-  c(rep(27,7),rep(26:1,each =25))
Data <- data.frame(x,y,color_name)

P<- Data |> 
     ggplot(aes(x =x, y=y,label =color_name))+
     geom_point(pch =22, size =7, fill = color_name) +
     theme(legend.position = "none") +theme_void()+
     labs(title = "Color names in R (657 colors)", x ="",y ="")

P |> ggplotly(tooltip = "label") |> 
     config( displayModeBar = FALSE)