taucharts icon indicating copy to clipboard operation
taucharts copied to clipboard

Scatter w/ Color + Trendline

Open S-UP opened this issue 7 years ago • 1 comments

Hi,

Just discovered this package. Generally very nice!

Question: It seems not possible to show the trend line simultaneously with colored scatter points when each point is its own group.

What I would like to achieve is having a legend identifying every point (as they represent store fronts in our case). For this I (afaik) need to specify 'color'. Yet color seems to do some sort of grouping as well, thus preventing the trend line to show up (as there is only one data point per group).

Is it possible to add a legend, preferably w/ colored observations, and add a trend line treating all points the same?

Shows a legend + trend line (but grouped):

tauchart(cars_data) %>%
  tau_point("milespergallon", c("class", "price"), color="class") %>%
  tau_trendline() %>% 
  tau_legend()

Shows legend but (almost) no trend line (changed color to vehicle to make the point):

tauchart(cars_data) %>%
  tau_point("milespergallon", "price", color="vehicle") %>%
  tau_trendline() %>% 
  tau_legend()

S-UP avatar Oct 17 '18 13:10 S-UP

As an alternative, if one could calculate trend line values independently and then add them as an additional layer, this could be a work around. But it seems combining e.g. tau_point and tau_line is not currently supported.

S-UP avatar Jan 30 '19 15:01 S-UP