echarts4r icon indicating copy to clipboard operation
echarts4r copied to clipboard

Point symbols and linetype with group_by()

Open psimm opened this issue 5 years ago • 1 comments

Could you please implement aesthetic mapping by group to have different linetypes and symbols for each group?

Currently different groups already get different colors but all the same point symbols: iris %>% group_by(Species) %>% e_charts(x = Sepal.Length) %>% e_scatter(Sepal.Width)

That is a good default, so what's missing is an optional argument. I'm not sure what the best interface would be here. The x in e_charts() along with grouping already works in a similar way to aes() in ggplot2, so that could be an inspiration.

psimm avatar Feb 23 '20 16:02 psimm

Scatter charts define only one symbol, i.e. group styling has not been implemented, yet.
But there is a workaround you may like with labels, which are formattable.

iris %>% group_by(Species) %>% e_charts(x = Sepal.Length) %>% 
  e_scatter(Sepal.Width, symbol='fake', 
    label=list(show=TRUE, formatter=htmlwidgets::JS("function(params){ 
      return( (params.seriesName=='setosa' ? String.fromCodePoint(0x1F354) : 
              (params.seriesName=='virginica' ? '👽' : '❤️')));
 }")))

Just kidding, serious researchers + emojis, non mais ça va pas ou quoi !

helgasoft avatar Jul 29 '20 00:07 helgasoft