Due to the static graph prepared by ggplot, we are migrating our graphs to googleVis with interactive diagrams. But when it comes to categorization, we face many problems. Let me give you an example to help you understand:
df = data.frame( x = sample(1:100), y = sample(1:100), cat = sample(c('a','b','c'), 100, replace=TRUE) )
ggplot2 provides a parameter such as alpha, colour, linetype, sizewhich we can use with categories such as the one shown below:
ggplot(df) + geom_line(aes(x = x, y = y, colour = cat))
Not only a line chart, but most ggplot2 graphs provide categorization based on column values. Now I would like to do the same in googleVis, based on value df$cat. I would like the parameters to be changed or grouped by lines or diagrams.
Note: I have already tried dcastto make several columns based on the category column and use these several columns as input Y, but this is not what I would like to do.
Can anyone help me in this regard?
Let me know if you need more information.
source
share