2
I’m trying to reproduce the chart below:
However, I am not able to color my chart through the function pal.bands according to the information that is in the spreadsheet below:
The data is found in this link: Database
The colors in which I am representing in the table above are defined below by and can be seen in the Pals package:
I need each color to be associated with the information that is in the above sheet, and each of the colors with their respective acronyms inside the chart, for example:
The acronyms are:
Control 0.00 Violet
Control 0.01 Violet
Control 0.02 Violet
.
.
.
Control 0.30 Green
Violet = Vi
Violet + Blue = Vi / Bl
Blue + Green = Bl / Gr
Green = Gr
Violet + Blue + Green = Vi / Bl / Gr
Below are the codes in R, however, I am not able to color through the function pal.bands nor insert the internal caption to the graphic:
library(RColorBrewer)
library(pals)
pal.bands(cubicyf)
dados = read.table("datagraph.csv", header=T, dec=",",sep=";")
dados$Group=as.factor(dados$Group)
dados$Colors=as.factor(dados$Colors)
x <- xtabs(~Concentration + Group, data = dados)
x
x11()
barplot(x,
beside = FALSE,
xlab = "Concentrations dose",
ylab = "Concentrations mol",
col = "pal.bands(cubicyf)")
legend("Vi", "Vi/Bl","Vi/Bl/Gr","Gr/Bl","Gr")
Error in rect(y1, x1, y2, x2, ...) :
invalid color name 'pal.bands(cubicyf)'
> legend("Vi", "Vi/Bl","Vi/Bl/Gr","Gr/Bl","Gr")
Error in match.arg(x, c("bottomright", "bottom", "bottomleft", "left", :
'arg' should be one of “bottomright”, “bottom”, “bottomleft”, “left”, “topleft”, “top”, “topright”, “right”, “center”