-
Notifications
You must be signed in to change notification settings - Fork 181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pkg updates #16
Pkg updates #16
Conversation
Uses the algorithm mentioned at https://stackoverflow.com/a/3943023/2022615 based on the luminance of the background color to determine black or white text. The threshold favored black text in a way that didn't look good with our plots, so I increased the threshold from 0.179 to 0.333.
Adds a few additional dplyr functions to the package imports, in particular: slice, data_frame, and row_number.
Currently only used for setting global text and title font sizes, but can be extended to other options that we may wish to set for more than one plot. For fonts, we now provide `set_font_size()` that can be used to set text and title sizes across all subsequent animations. Includes internal getter functions get_{text|title}_size().
Sets figure output to man/figures/tidyexplain- and ensures that all R chunks that output figures are named. This gives a collection of animations and static images with reasonable names ready for download and use.
Changed name of set_text_color() to choose_text_color() to avoid confusion with the global option setter functions, e.g. set_text_size(). Updated tests to reflect modified threshold.
animate_join() now lives in animate_join.R with the other animate_join_ functions. These all use rlang::enquo() to capture their arguments so that animate_join() can print the variable name in the plot title.
And change Long/Wide to lowercase to reflect that they are both variables names and a description of the state of the data.
Adds get_input_text() that can be used to get the literal variable name and make_named_data() that creates a list with the input data frames. This second one is necessary because the inputs may be quosures and we need to get the underlying data frames. Default names are $x and $y.
- Use quasiquotation to get variable names - Unified documentation - Use match.arg to guard for correct arguments in type and export - Removed animate_helpers.R
Tried to put this in a gist via reprex but couldn't get it to work, but now the following should all work: library(tidyexplain)
wide <- tibble::data_frame(
year = 2010:2011,
Alice = c(105, 110),
Bob = c(100, 97),
Charlie = c(90, 95)
)
set_font_size(4.5, 15)
animate_gather(wide, key = "person", value = "sales", -year)
animate_gather(wide, key = "person", value = "sales", Alice:Charlie)
animate_gather(wide, key = "person", value = "sales", -1) |
Looks like you did a wonderful job. Didn't have the time to go through it entirely but what I saw look really good. |
Calls to tidyr and dplyr are now prefixed with package name. This lets us use the README as a test to make sure all namespace issues are fixed. We can roll this back when the package is more stable.
And demonstrates usage with the tidyr gather/spread animators. In essence, user-facing functions take an argument `anim_opts = anim_options()` as a last argument (after ... if applicable). These options should be passed through to lower level functions and should be given to `animate_plot()` and `static_plot()`. This implementation actually doesn't break previous functions, but the join and set families will need to be updated to match.
And update documentation for both options
Set option "tidyexplain.strict_dots" to TRUE for checking for issues with extra arguments being passed in ... to the _plot() functions.
ggproto objects like those created by enter_fade() or exit_appear() evaluate to enviroments making it impossible to compare two ggproto objects to determine if they are the same (both will be different environments). To get around this, I store the expression used to create the enter/exit arguments so that we can later compare two objects created by anim_options().
- Collected in animate_options.R - Sets global defaults in plot_settings environment - Adds ability to set animation options, similar to theme_set() from ggplot2 - Adds getters for current (if set) or default animation options Merge branch 'pkg-add-anim-options-merge' into pkg-add-anim-options # Conflicts: # NAMESPACE # R/animate_tidyr.R # R/plot_helpers.R # man/anim_options.Rd # man/animate_gather.Rd # man/animate_spread.Rd # man/static_plot.Rd
Leads to better documentation where it is easier to understand how to use the anim_opts parameter
And no need to filter out NULL elements
Add framework for animation options (fixed)
A variety of smallish updates that are probably best explained via the commit messages. I'm pushing this as a PR because I moved a few things around and wanted to give you a chance to review or at least be able to browse the incoming changes in one place.