drawr.Rd
Makes a static you-draw-it chart that can go into an rmarkdown or work as a standalone html plot. Inspired by the New York Times article You Draw It: How Family Income Predicts Children’s College
drawr(data, x_col, y_col = NULL, free_draw = FALSE, draw_start = NULL, title = NULL, pin_start = TRUE, x_range = NULL, y_range = NULL, x_lab = NULL, y_lab = NULL, line_style = NULL, drawn_line_color = "orangered", data_line_color = "steelblue", x_axis_buffer = 0.02, y_axis_buffer = 0.1, shiny_message_loc = NULL)
data | Tibble to draw |
---|---|
x_col | Name of column for x axis |
y_col | Name of column for y axis |
free_draw | Do you just want the user to draw data on a supplied x-range? I.e. no revealed line? |
draw_start | Where on the x axis to start obscuring data for drawing? Defaults to very start of data. |
title | Text for title, if desired. |
pin_start | Pin start of drawn line to end of shown data? Defaults to
|
x_range | Two element array of min and max of x range. Otherwise defaults to min and max of data. |
y_range | Two element array of min and max of y range. Otherwise defaults to min and max of data. |
x_lab | Text to label x axis, defaults to name of column used for x-axis |
y_lab | Text to label y axis, defaults to name of column, or in
free-draw case, to just |
line_style | List containing any styling that is desired for the default line. For options see MDN: SVG line. Make sure to camelCase all attributes. |
drawn_line_color | CSS valid color for user-drawn line. Defaults to
|
data_line_color | CSS valid color for data line. Defaults to
|
x_axis_buffer | Scaler for how much to pad ends of x axis if not
specifying range directly. Defaults to 2% ( |
y_axis_buffer | Scaler for how much to pad ends of y axis if not
specifying range directly. Defaults to 10% ( |
shiny_message_loc | A string containing the destination to target for
shiny message passing. Used by |
Interactive you-draw-it plot.