Closed z3tt closed 2 years ago
Thanks!
I'm going to consolidate the color options and palette into a single vector of colors, as opposed to many arguments. These will be then subsetted by position internally in the function.
The current plan is a vector of length 5:
The type_color
will be used for interquantile range area (ie tufte style 0.25/0.75 range), filled area/shaded sparklines, median/mean reference line, and a sparkline with ALL values as geom_points()
Does that align with your needs/suggestions?
See the plot options below :
Howdy @z3tt - note the new behavior, I have split out gt_sparkline()
into two functions, gt_plt_dist()
for distributions (ie boxplot, density, histogram) and gt_plt_sparkline()
for more traditional sparklines.
For your desired behavior, option 1 with the new pal
argument.
library(gt)
library(gtExtras)
mtcars %>%
dplyr::group_by(cyl) %>%
# must end up with list of data for each row in the input dataframe
dplyr::summarize(mpg_data = list(mpg), .groups = "drop") %>%
gt() %>%
gt_plt_sparkline(mpg_data,
# note the colors - grey line, blue end points with blue label
# purple low val, green high value, and blue "type" value
# where type is not used in the default
pal = c("grey", "blue", "purple", "green", "blue")) %>%
gtsave("test.png")
Created on 2021-12-20 by the reprex package (v2.0.1)
Hi Thomas, thanks for this great package!
Related to #31 I would like to suggest an option to control the color of the non-extreme points in the
gt_sparkline()
function. Currently, there are arguments forline_color
andrange_color
with the latter being a "vector of two valid color names or hex codes" but I couldn't find any way to control the color of the last point (and, in case #31 may be implemented in the future, also the color of the intermediate points).