diff --git a/DESCRIPTION b/DESCRIPTION index 9d455634..43ae9343 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: tourr Title: Tour Methods for Multivariate Data Visualisation -Version: 1.2.3 +Version: 1.2.4 Authors@R: c( person("Hadley", "Wickham", email = "h.wickham@gmail.com", role = c("aut", "ctb"), comment = c(ORCID = "0000-0003-4757-117X")), person("Dianne", "Cook", email = "dicook@monash.edu", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-3813-7155")), diff --git a/NEWS.md b/NEWS.md index 57299126..5efb6194 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,8 @@ +# tourr 1.2.4 + +* Fixed an error with draw_tour_axes +* Added documentation on plotting a particular projection + # tourr 1.2.3 * New optimisation routine, using the jellyfish optimiser. diff --git a/R/display-xy.r b/R/display-xy.r index 54beaa05..73d1a080 100644 --- a/R/display-xy.r +++ b/R/display-xy.r @@ -34,10 +34,12 @@ #' @examples #' animate_xy(flea[, 1:6]) #' animate(flea[, 1:6], tour_path = grand_tour(), display = display_xy()) +#' # This won't do anything because the flea data is standardised +#' # but use rescale option to force scaling before displaying #' animate(flea[, 1:6], #' tour_path = grand_tour(), #' display = display_xy(), -#' scale = TRUE +#' rescale = TRUE #' ) #' animate(flea[, 1:6], #' tour_path = grand_tour(), @@ -289,10 +291,10 @@ animate_xy <- function(data, tour_path = grand_tour(), ...) { #' xlim = c(-3, 3), ylim = c(-3, 3), #' xlab="P1", ylab="P2") #' draw_tour_axes(prj, colnames(flea)[1:6], limits=3, position="bottomleft") -#' draw_tour_axes(prj, colnames(flea)[1:6], axislablong=TRUE) +#' draw_tour_axes(prj, colnames(flea)[1:6], longlabels=TRUE) draw_tour_axes <- function(proj, labels, limits=1, position="center", axis.col="grey50", axis.lwd=1, axis.text.col="grey50", - longlabels, ...) { + longlabels=FALSE, ...) { position <- match.arg(position, c("center", "bottomleft", "off")) if (position == "off") { return() diff --git a/R/history.r b/R/history.r index e176a2c8..f774de30 100644 --- a/R/history.r +++ b/R/history.r @@ -31,13 +31,20 @@ #' testdata <- matrix(rnorm(100 * 3), ncol = 3) #' testdata[1:50, 1] <- testdata[1:50, 1] + 10 #' testdata <- sphere_data(testdata) -#' t2 <- save_history(testdata, guided_tour(holes(), max.tries = 10), +#' t2 <- save_history(testdata, guided_tour(holes()), #' max = 5 #' ) #' animate_xy(testdata, planned_tour(t2)) #' #' # Or you can use saved histories to visualise the path that the tour took. #' plot(path_index(interpolate(t2), holes())) +#' +#' # And you can plot any individual frame using +#' best_prj <- matrix(t2[,,3], ncol=2) +#' p <- render_proj(testdata, best_prj) +#' # which creates a data frame with the elements +#' # to make the plot, see render_proj() for plotting code +#' # OR see draw_tour_axes() for similar code in base graphics save_history <- function(data, tour_path = grand_tour(), max_bases = 100, start = NULL, rescale = FALSE, sphere = FALSE, step_size = Inf, ...) { if (!is.matrix(data)) { diff --git a/R/search-jellyfish.R b/R/search-jellyfish.R index dba60400..c383673e 100644 --- a/R/search-jellyfish.R +++ b/R/search-jellyfish.R @@ -89,7 +89,7 @@ search_jellyfish <- function(current, index, tries, max.tries = 50, ...) { #' @param bases a list of bases extracted from the data collection object, see examples #' @param min_dist the minimum distance between two bases #' @rdname jellyfish -#' @export; +#' @export check_dup <- function(bases, min_dist) { res <- list() res[[1]] <- bases[[1]] diff --git a/man/display_xy.Rd b/man/display_xy.Rd index fb1eecc5..1b8ddcac 100644 --- a/man/display_xy.Rd +++ b/man/display_xy.Rd @@ -83,10 +83,12 @@ Animate a 2D tour path with a scatterplot. \examples{ animate_xy(flea[, 1:6]) animate(flea[, 1:6], tour_path = grand_tour(), display = display_xy()) +# This won't do anything because the flea data is standardised +# but use rescale option to force scaling before displaying animate(flea[, 1:6], tour_path = grand_tour(), display = display_xy(), - scale = TRUE + rescale = TRUE ) animate(flea[, 1:6], tour_path = grand_tour(), diff --git a/man/draw_tour_axes.Rd b/man/draw_tour_axes.Rd index c73aa71b..4f7706aa 100644 --- a/man/draw_tour_axes.Rd +++ b/man/draw_tour_axes.Rd @@ -12,7 +12,7 @@ draw_tour_axes( axis.col = "grey50", axis.lwd = 1, axis.text.col = "grey50", - longlabels, + longlabels = FALSE, ... ) } @@ -56,5 +56,5 @@ plot(flea_prj$V1, flea_prj$V2, xlim = c(-3, 3), ylim = c(-3, 3), xlab="P1", ylab="P2") draw_tour_axes(prj, colnames(flea)[1:6], limits=3, position="bottomleft") -draw_tour_axes(prj, colnames(flea)[1:6], axislablong=TRUE) +draw_tour_axes(prj, colnames(flea)[1:6], longlabels=TRUE) } diff --git a/man/save_history.Rd b/man/save_history.Rd index 89bc020f..c71689c8 100644 --- a/man/save_history.Rd +++ b/man/save_history.Rd @@ -55,11 +55,18 @@ animate_xy(flea[, 1:6], planned_tour(t1)) testdata <- matrix(rnorm(100 * 3), ncol = 3) testdata[1:50, 1] <- testdata[1:50, 1] + 10 testdata <- sphere_data(testdata) -t2 <- save_history(testdata, guided_tour(holes(), max.tries = 10), +t2 <- save_history(testdata, guided_tour(holes()), max = 5 ) animate_xy(testdata, planned_tour(t2)) # Or you can use saved histories to visualise the path that the tour took. plot(path_index(interpolate(t2), holes())) + +# And you can plot any individual frame using +best_prj <- matrix(t2[,,3], ncol=2) +p <- render_proj(testdata, best_prj) +# which creates a data frame with the elements +# to make the plot, see render_proj() for plotting code +# OR see draw_tour_axes() for similar code in base graphics } diff --git a/tourr.Rproj b/tourr.Rproj index 0ee12cde..0673c883 100644 --- a/tourr.Rproj +++ b/tourr.Rproj @@ -1,4 +1,5 @@ Version: 1.0 +ProjectId: 5fab2785-ed39-43d4-a1dc-d96ebd55dfd1 RestoreWorkspace: No SaveWorkspace: No