googleVis: Colors with alpha < 1

151 views Asked by At

I am trying to use some colors with alpha < 1 in googlevis chart without success.

My initial Color List that is applied is:

MyColors <- c('#DD4477', '#109618', '#AAAA11)

Then I apply the function adjustcolor: MyAlphaColors <- adjustcolor(MyColors, 0.4)

If I try to use these colors in a googlevis chart I get the error: #109618E6 is not a valid color string

How could I overcome this problem and use some colors with alpha < 1 in my googlevis charts?

Here is a reproducible example (in that particular case I don't get the error message but the second series colors are not plotted properly):

library(googleVis)
MyColors <- c('#DD4477', '#109618', '#AAAA11')

df <- data.frame(country=c("US", "GB", "BR"), val1=c(10,13,14), val1.style = MyColors, val2=c(23,12,32), val2.style = adjustcolor(MyColors, 0.4))

plot(gvisColumnChart(df, xvar="country", yvar=c(colnames(df)[2], colnames(df)[3], colnames(df)[4], colnames(df)[5]),
                     options=list(legend="none",
                                  chartArea = "{left:'10%',top:'10%',width:'80%',height:'70%'}",
                                  height=750,
                                  width=1050,
                                  backgroundColor = "white")
                     )
    )
0

There are 0 answers