Вопрос

I'm using the rgrs package to creat a qualitative based map. I'm not a fan of the palettes provided by ColorBrewer, how can I define my own colour palette?

I tried the following...

pal<-c("#2ca25f","#99d8c9","#99d8c9")

carte.qual(Frdep, Corr, "Niveau_correlation", sp.key = "CODE_DEPT", 
       data.key = "Dep", 
       palette.qual="pal", border="grey25", 
       leg.options=list(rect.width=0.025, rect.height=0.045, 
                        inset=c(0.68, 0.345), cex=0.85))

Which returns the following error message:

Error in brewer.pal(qual.nb, palette.qual) : 
pal is not a valid palette name for brewer.pal

Removing the speech marks from "pal" returns the same message. Can anyone help?

Это было полезно?

Решение

It looks like you're using the palette.qual when you should be using the palette argument. Your code should read:

pal<-c("#2ca25f","#99d8c9","#99d8c9")

carte.qual(Frdep, Corr, "Niveau_correlation", sp.key = "CODE_DEPT", 
       data.key = "Dep", 
       palette=pal, border="grey25", 
       leg.options=list(rect.width=0.025, rect.height=0.045, 
                        inset=c(0.68, 0.345), cex=0.85))
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top