diff --git a/DESCRIPTION b/DESCRIPTION index 9614222..f7681eb 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -15,7 +15,7 @@ Description: Diagnostic plots for optimisation, with a focus on projection pursu License: MIT + file LICENSE Encoding: UTF-8 LazyData: true -URL: https://github.com/huizezhang-sherry/ferrn/ +URL: https://github.com/huizezhang-sherry/ferrn/, https://huizezhang-sherry.github.io/ferrn BugReports: https://github.com/huizezhang-sherry/ferrn/issues Imports: rlang (>= 0.1.2), @@ -34,7 +34,7 @@ Imports: cli, progress, glue, - GpGp, + GpGp RoxygenNote: 7.3.2 Depends: R (>= 2.10) @@ -46,5 +46,5 @@ Suggests: forcats, patchwork, future.apply, - ash + ash, Language: en-GB diff --git a/R/explore-space-tour.R b/R/explore-space-tour.R index 9d8824a..27183f8 100644 --- a/R/explore-space-tour.R +++ b/R/explore-space-tour.R @@ -35,9 +35,11 @@ explore_space_tour <- function(..., axes = "bottomleft") { #' @param axes see [tourr::animate_xy()] #' @param ... other argument passed to \code{tourr::animate_xy()} and \code{prep_space_tour()} #' @examples +#' if (FALSE){ #' explore_space_tour(dplyr::bind_rows(holes_1d_better, holes_1d_geo), #' group = method, palette = botanical_palettes$fern[c(1, 6)] #' ) +#' } #' @rdname explore_space_tour #' @export prep_space_tour <- function(dt, group = NULL, flip = FALSE, n_random = 2000, diff --git a/R/huber-plot.R b/R/huber-plot.R index f6d702e..d42f023 100644 --- a/R/huber-plot.R +++ b/R/huber-plot.R @@ -1,33 +1,50 @@ #' Create Huber plot with ggplot2 #' +#' The Huber plot presents the projection pursuit index values of 2D data in each 1D +#' projection in polar coordinates, corresponding to each projection direction. +#' It offers a simpler illustration of more complex projection from +#' high-dimensional data to lower dimensions in projection pursuit. The +#' function \code{prep_huber()} calculates each component required for the Huber plot +#' (see details), which can then be supplied to various geom layers in ggplot2. +#' +#' @details the \code{prep_huber()} function calculates components required for +#' making the Huber plots. It returns a list including three elements: +#'\describe{ +#' \item{the \code{idx_df} data frame: }{the x/y coordinates of the index value, in polar +#' coordinates. Used for plotting the index value at each projection direction, +#' with the reference circle.} +#' \item{the \code{proj_df} data frame: }{the best 1D projection. Used for plotting +#' the 1D projection in histogram.} +#' \item{the \code{slope} value: }{the slope to plot in the Huber plot to indicate the +#' direction of the best 1D projection.} +#' } #' @inheritParams ggplot2::layer #' @inheritParams ggplot2::geom_path #' @param index a function, the projection pursuit index function, see examples #' @rdname huber #' @export #' @examples -#' if (require(ash, quietly = TRUE)) { -#' library(ggplot2) -#' library(tourr) -#' data(randu) -#' randu_std <- as.data.frame(apply(randu, 2, function(x) (x-mean(x))/sd(x))) -#' randu_std$yz <- sqrt(35)/6*randu_std$y-randu_std$z/6 -#' randu_df <- randu_std[c(1,4)] -#' randu_huber <- prep_huber(randu_df, index = norm_bin(nr = nrow(randu_df))) +#' library(ggplot2) +#' library(tourr) +#' library(ash) +#' data(randu) +#' randu_std <- as.data.frame(apply(randu, 2, function(x) (x-mean(x))/sd(x))) +#' randu_std$yz <- sqrt(35)/6*randu_std$y-randu_std$z/6 +#' randu_df <- randu_std[c(1,4)] +#' randu_huber <- prep_huber(randu_df, index = norm_bin(nr = nrow(randu_df))) #' -#' ggplot() + -#' geom_huber(data = randu_huber$idx_df, aes(x = x, y = y)) + -#' geom_point(data = randu_df, aes(x = x, y = yz)) + -#' geom_abline(slope = randu_huber$slope, intercept = 0) + -#' theme_huber() + -#' coord_fixed() +#' ggplot() + +#' geom_huber(data = randu_huber$idx_df, aes(x = x, y = y)) + +#' geom_point(data = randu_df, aes(x = x, y = yz)) + +#' geom_abline(slope = randu_huber$slope, intercept = 0) + +#' theme_huber() + +#' coord_fixed() #' -#' ggplot(randu_huber$proj_df, aes(x = x)) + -#' geom_histogram(breaks = seq(-2.2, 2.4, 0.12)) + -#' xlab("") + ylab("") + -#' theme_bw() + -#' theme(axis.text.y = element_blank()) -#'} +#' ggplot(randu_huber$proj_df, aes(x = x)) + +#' geom_histogram(breaks = seq(-2.2, 2.4, 0.12)) + +#' xlab("") + ylab("") + +#' theme_bw() + +#' theme(axis.text.y = element_blank()) geom_huber <- function(mapping = NULL, data = NULL, stat = "identity", position = "identity", ..., show.legend = NA, inherit.aes = TRUE) { diff --git a/_pkgdown.yml b/_pkgdown.yml index 360a396..160f087 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -2,9 +2,7 @@ url: https://huizezhang-sherry.github.io/ferrn/ template: - params: - bootswatch: cosmo - ganalytics: G-SPC6B94B10 + bootstrap: 5 reference: - title: Main plotting functions @@ -18,6 +16,9 @@ reference: - plot_projection - flip_sign - geom_huber +- title: Calculate projection pursuit index metrics + contents: + - starts_with("calc") - title: Get components desc: > Extracting components from existing data object @@ -47,9 +48,6 @@ reference: contents: - starts_with("boa") - starts_with("holes") -- title: Calculate projection pursuit optimisation properties - contents: - - starts_with("calc") - title: Miscellaneous desc: > Other misc functions diff --git a/docs/404.html b/docs/404.html index bea073c..811556d 100644 --- a/docs/404.html +++ b/docs/404.html @@ -4,7 +4,7 @@ - + Page not found (404) • ferrn @@ -12,105 +12,70 @@ - - - - - - + + + + + - - - - -
-
-
- Content not found. Please use links in the navbar. -
- - - +
- -
- diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index e1dfe5d..f69264d 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -1,81 +1,52 @@ -License • ferrn - - -
-
- - - -
-
- -
YEAR: 2020
-COPYRIGHT HOLDER: Sherry Zhang
-
+
+
+
-
+
YEAR: 2020
+COPYRIGHT HOLDER: Sherry Zhang
+
+
-
- +
diff --git a/docs/LICENSE.html b/docs/LICENSE.html index 6e2d5bc..57159dc 100644 --- a/docs/LICENSE.html +++ b/docs/LICENSE.html @@ -1,55 +1,34 @@ -MIT License • ferrn - - -
-
-
- +
+
+
@@ -60,26 +39,18 @@

MIT License

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

-
- - - -
- +
-
- +
diff --git a/docs/authors.html b/docs/authors.html index 8d35f3c..195dbca 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -1,58 +1,37 @@ -Authors and Citation • ferrn - - -
-
-
-
- +
+
+
+
+
+

Authors

  • H. Sherry Zhang. Author, maintainer. @@ -75,16 +54,13 @@

    Authors and Citation

-
-
-

Citation

- Source: inst/CITATION -
-
+
+

Citation

+

Source: inst/CITATION

-

Zhang H Sherry, Cook D, Laa U, Langrené N, Menéndez P (2021). Visual Diagnostics for Constrained Optimisation with Application to Guided Tours. The R Journal, 13(2), 624–641. https://doi.org/10.32614/RJ-2021-105.

-
@Article{,
+      

Zhang H Sherry, Cook D, Laa U, Langrené N, Menéndez P (2021). Visual Diagnostics for Constrained Optimisation with Application to Guided Tours. The R Journal, 13(2), 624–641. https://doi.org/10.32614/RJ-2021-105.

+
@Article{,
   title = {Visual Diagnostics for Constrained Optimisation with Application to Guided Tours},
   author = {H. Sherry Zhang and Dianne Cook and Ursula Laa and Nicolas Langren{é} and Patricia Men{é}ndez},
   journal = {The R Journal},
@@ -94,23 +70,21 @@ 

Citation

pages = {624-641}, doi = {10.32614/RJ-2021-105}, }
+
-
- -
- +
-
- +
diff --git a/docs/bootstrap-toc.css b/docs/bootstrap-toc.css deleted file mode 100644 index 5a85941..0000000 --- a/docs/bootstrap-toc.css +++ /dev/null @@ -1,60 +0,0 @@ -/*! - * Bootstrap Table of Contents v0.4.1 (http://afeld.github.io/bootstrap-toc/) - * Copyright 2015 Aidan Feldman - * Licensed under MIT (https://github.com/afeld/bootstrap-toc/blob/gh-pages/LICENSE.md) */ - -/* modified from https://github.com/twbs/bootstrap/blob/94b4076dd2efba9af71f0b18d4ee4b163aa9e0dd/docs/assets/css/src/docs.css#L548-L601 */ - -/* All levels of nav */ -nav[data-toggle='toc'] .nav > li > a { - display: block; - padding: 4px 20px; - font-size: 13px; - font-weight: 500; - color: #767676; -} -nav[data-toggle='toc'] .nav > li > a:hover, -nav[data-toggle='toc'] .nav > li > a:focus { - padding-left: 19px; - color: #563d7c; - text-decoration: none; - background-color: transparent; - border-left: 1px solid #563d7c; -} -nav[data-toggle='toc'] .nav > .active > a, -nav[data-toggle='toc'] .nav > .active:hover > a, -nav[data-toggle='toc'] .nav > .active:focus > a { - padding-left: 18px; - font-weight: bold; - color: #563d7c; - background-color: transparent; - border-left: 2px solid #563d7c; -} - -/* Nav: second level (shown on .active) */ -nav[data-toggle='toc'] .nav .nav { - display: none; /* Hide by default, but at >768px, show it */ - padding-bottom: 10px; -} -nav[data-toggle='toc'] .nav .nav > li > a { - padding-top: 1px; - padding-bottom: 1px; - padding-left: 30px; - font-size: 12px; - font-weight: normal; -} -nav[data-toggle='toc'] .nav .nav > li > a:hover, -nav[data-toggle='toc'] .nav .nav > li > a:focus { - padding-left: 29px; -} -nav[data-toggle='toc'] .nav .nav > .active > a, -nav[data-toggle='toc'] .nav .nav > .active:hover > a, -nav[data-toggle='toc'] .nav .nav > .active:focus > a { - padding-left: 28px; - font-weight: 500; -} - -/* from https://github.com/twbs/bootstrap/blob/e38f066d8c203c3e032da0ff23cd2d6098ee2dd6/docs/assets/css/src/docs.css#L631-L634 */ -nav[data-toggle='toc'] .nav > .active > ul { - display: block; -} diff --git a/docs/bootstrap-toc.js b/docs/bootstrap-toc.js deleted file mode 100644 index 1cdd573..0000000 --- a/docs/bootstrap-toc.js +++ /dev/null @@ -1,159 +0,0 @@ -/*! - * Bootstrap Table of Contents v0.4.1 (http://afeld.github.io/bootstrap-toc/) - * Copyright 2015 Aidan Feldman - * Licensed under MIT (https://github.com/afeld/bootstrap-toc/blob/gh-pages/LICENSE.md) */ -(function() { - 'use strict'; - - window.Toc = { - helpers: { - // return all matching elements in the set, or their descendants - findOrFilter: function($el, selector) { - // http://danielnouri.org/notes/2011/03/14/a-jquery-find-that-also-finds-the-root-element/ - // http://stackoverflow.com/a/12731439/358804 - var $descendants = $el.find(selector); - return $el.filter(selector).add($descendants).filter(':not([data-toc-skip])'); - }, - - generateUniqueIdBase: function(el) { - var text = $(el).text(); - var anchor = text.trim().toLowerCase().replace(/[^A-Za-z0-9]+/g, '-'); - return anchor || el.tagName.toLowerCase(); - }, - - generateUniqueId: function(el) { - var anchorBase = this.generateUniqueIdBase(el); - for (var i = 0; ; i++) { - var anchor = anchorBase; - if (i > 0) { - // add suffix - anchor += '-' + i; - } - // check if ID already exists - if (!document.getElementById(anchor)) { - return anchor; - } - } - }, - - generateAnchor: function(el) { - if (el.id) { - return el.id; - } else { - var anchor = this.generateUniqueId(el); - el.id = anchor; - return anchor; - } - }, - - createNavList: function() { - return $(''); - }, - - createChildNavList: function($parent) { - var $childList = this.createNavList(); - $parent.append($childList); - return $childList; - }, - - generateNavEl: function(anchor, text) { - var $a = $(''); - $a.attr('href', '#' + anchor); - $a.text(text); - var $li = $('
  • '); - $li.append($a); - return $li; - }, - - generateNavItem: function(headingEl) { - var anchor = this.generateAnchor(headingEl); - var $heading = $(headingEl); - var text = $heading.data('toc-text') || $heading.text(); - return this.generateNavEl(anchor, text); - }, - - // Find the first heading level (`

    `, then `

    `, etc.) that has more than one element. Defaults to 1 (for `

    `). - getTopLevel: function($scope) { - for (var i = 1; i <= 6; i++) { - var $headings = this.findOrFilter($scope, 'h' + i); - if ($headings.length > 1) { - return i; - } - } - - return 1; - }, - - // returns the elements for the top level, and the next below it - getHeadings: function($scope, topLevel) { - var topSelector = 'h' + topLevel; - - var secondaryLevel = topLevel + 1; - var secondarySelector = 'h' + secondaryLevel; - - return this.findOrFilter($scope, topSelector + ',' + secondarySelector); - }, - - getNavLevel: function(el) { - return parseInt(el.tagName.charAt(1), 10); - }, - - populateNav: function($topContext, topLevel, $headings) { - var $context = $topContext; - var $prevNav; - - var helpers = this; - $headings.each(function(i, el) { - var $newNav = helpers.generateNavItem(el); - var navLevel = helpers.getNavLevel(el); - - // determine the proper $context - if (navLevel === topLevel) { - // use top level - $context = $topContext; - } else if ($prevNav && $context === $topContext) { - // create a new level of the tree and switch to it - $context = helpers.createChildNavList($prevNav); - } // else use the current $context - - $context.append($newNav); - - $prevNav = $newNav; - }); - }, - - parseOps: function(arg) { - var opts; - if (arg.jquery) { - opts = { - $nav: arg - }; - } else { - opts = arg; - } - opts.$scope = opts.$scope || $(document.body); - return opts; - } - }, - - // accepts a jQuery object, or an options object - init: function(opts) { - opts = this.helpers.parseOps(opts); - - // ensure that the data attribute is in place for styling - opts.$nav.attr('data-toggle', 'toc'); - - var $topContext = this.helpers.createChildNavList(opts.$nav); - var topLevel = this.helpers.getTopLevel(opts.$scope); - var $headings = this.helpers.getHeadings(opts.$scope, topLevel); - this.helpers.populateNav($topContext, topLevel, $headings); - } - }; - - $(function() { - $('nav[data-toggle="toc"]').each(function(i, el) { - var $nav = $(el); - Toc.init($nav); - }); - }); -})(); diff --git a/docs/docsearch.css b/docs/docsearch.css deleted file mode 100644 index e5f1fe1..0000000 --- a/docs/docsearch.css +++ /dev/null @@ -1,148 +0,0 @@ -/* Docsearch -------------------------------------------------------------- */ -/* - Source: https://github.com/algolia/docsearch/ - License: MIT -*/ - -.algolia-autocomplete { - display: block; - -webkit-box-flex: 1; - -ms-flex: 1; - flex: 1 -} - -.algolia-autocomplete .ds-dropdown-menu { - width: 100%; - min-width: none; - max-width: none; - padding: .75rem 0; - background-color: #fff; - background-clip: padding-box; - border: 1px solid rgba(0, 0, 0, .1); - box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .175); -} - -@media (min-width:768px) { - .algolia-autocomplete .ds-dropdown-menu { - width: 175% - } -} - -.algolia-autocomplete .ds-dropdown-menu::before { - display: none -} - -.algolia-autocomplete .ds-dropdown-menu [class^=ds-dataset-] { - padding: 0; - background-color: rgb(255,255,255); - border: 0; - max-height: 80vh; -} - -.algolia-autocomplete .ds-dropdown-menu .ds-suggestions { - margin-top: 0 -} - -.algolia-autocomplete .algolia-docsearch-suggestion { - padding: 0; - overflow: visible -} - -.algolia-autocomplete .algolia-docsearch-suggestion--category-header { - padding: .125rem 1rem; - margin-top: 0; - font-size: 1.3em; - font-weight: 500; - color: #00008B; - border-bottom: 0 -} - -.algolia-autocomplete .algolia-docsearch-suggestion--wrapper { - float: none; - padding-top: 0 -} - -.algolia-autocomplete .algolia-docsearch-suggestion--subcategory-column { - float: none; - width: auto; - padding: 0; - text-align: left -} - -.algolia-autocomplete .algolia-docsearch-suggestion--content { - float: none; - width: auto; - padding: 0 -} - -.algolia-autocomplete .algolia-docsearch-suggestion--content::before { - display: none -} - -.algolia-autocomplete .ds-suggestion:not(:first-child) .algolia-docsearch-suggestion--category-header { - padding-top: .75rem; - margin-top: .75rem; - border-top: 1px solid rgba(0, 0, 0, .1) -} - -.algolia-autocomplete .ds-suggestion .algolia-docsearch-suggestion--subcategory-column { - display: block; - padding: .1rem 1rem; - margin-bottom: 0.1; - font-size: 1.0em; - font-weight: 400 - /* display: none */ -} - -.algolia-autocomplete .algolia-docsearch-suggestion--title { - display: block; - padding: .25rem 1rem; - margin-bottom: 0; - font-size: 0.9em; - font-weight: 400 -} - -.algolia-autocomplete .algolia-docsearch-suggestion--text { - padding: 0 1rem .5rem; - margin-top: -.25rem; - font-size: 0.8em; - font-weight: 400; - line-height: 1.25 -} - -.algolia-autocomplete .algolia-docsearch-footer { - width: 110px; - height: 20px; - z-index: 3; - margin-top: 10.66667px; - float: right; - font-size: 0; - line-height: 0; -} - -.algolia-autocomplete .algolia-docsearch-footer--logo { - background-image: url("data:image/svg+xml;utf8,"); - background-repeat: no-repeat; - background-position: 50%; - background-size: 100%; - overflow: hidden; - text-indent: -9000px; - width: 100%; - height: 100%; - display: block; - transform: translate(-8px); -} - -.algolia-autocomplete .algolia-docsearch-suggestion--highlight { - color: #FF8C00; - background: rgba(232, 189, 54, 0.1) -} - - -.algolia-autocomplete .algolia-docsearch-suggestion--text .algolia-docsearch-suggestion--highlight { - box-shadow: inset 0 -2px 0 0 rgba(105, 105, 105, .5) -} - -.algolia-autocomplete .ds-suggestion.ds-cursor .algolia-docsearch-suggestion--content { - background-color: rgba(192, 192, 192, .15) -} diff --git a/docs/docsearch.js b/docs/docsearch.js deleted file mode 100644 index b35504c..0000000 --- a/docs/docsearch.js +++ /dev/null @@ -1,85 +0,0 @@ -$(function() { - - // register a handler to move the focus to the search bar - // upon pressing shift + "/" (i.e. "?") - $(document).on('keydown', function(e) { - if (e.shiftKey && e.keyCode == 191) { - e.preventDefault(); - $("#search-input").focus(); - } - }); - - $(document).ready(function() { - // do keyword highlighting - /* modified from https://jsfiddle.net/julmot/bL6bb5oo/ */ - var mark = function() { - - var referrer = document.URL ; - var paramKey = "q" ; - - if (referrer.indexOf("?") !== -1) { - var qs = referrer.substr(referrer.indexOf('?') + 1); - var qs_noanchor = qs.split('#')[0]; - var qsa = qs_noanchor.split('&'); - var keyword = ""; - - for (var i = 0; i < qsa.length; i++) { - var currentParam = qsa[i].split('='); - - if (currentParam.length !== 2) { - continue; - } - - if (currentParam[0] == paramKey) { - keyword = decodeURIComponent(currentParam[1].replace(/\+/g, "%20")); - } - } - - if (keyword !== "") { - $(".contents").unmark({ - done: function() { - $(".contents").mark(keyword); - } - }); - } - } - }; - - mark(); - }); -}); - -/* Search term highlighting ------------------------------*/ - -function matchedWords(hit) { - var words = []; - - var hierarchy = hit._highlightResult.hierarchy; - // loop to fetch from lvl0, lvl1, etc. - for (var idx in hierarchy) { - words = words.concat(hierarchy[idx].matchedWords); - } - - var content = hit._highlightResult.content; - if (content) { - words = words.concat(content.matchedWords); - } - - // return unique words - var words_uniq = [...new Set(words)]; - return words_uniq; -} - -function updateHitURL(hit) { - - var words = matchedWords(hit); - var url = ""; - - if (hit.anchor) { - url = hit.url_without_anchor + '?q=' + escape(words.join(" ")) + '#' + hit.anchor; - } else { - url = hit.url + '?q=' + escape(words.join(" ")); - } - - return url; -} diff --git a/docs/index.html b/docs/index.html index e03e336..615532e 100644 --- a/docs/index.html +++ b/docs/index.html @@ -4,7 +4,7 @@ - + Facilitate Exploration of touRR optimisatioN • ferrn @@ -12,77 +12,53 @@ - - - - - - + + + + + + - - - - -
    -
    - +
    -
    + 0.2.0 -
    - +
    +
    +
    + +

    +

    The ferrn package extracts key components from the data object collected during projection pursuit (PP) guided tour optimisation, produces diagnostic plots, and calculates PP index scores.

    @@ -164,10 +140,7 @@

    Reference - +

    -
    - diff --git a/docs/news/index.html b/docs/news/index.html index 0d3568d..464a999 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -1,97 +1,69 @@ -Changelog • ferrn - - -
    -
    +
    -
    - +
    +
    +
    - +

    ferrn 0.2.0

    - +

    ferrn 0.1.0

    CRAN release: 2024-06-23

    - +

    ferrn 0.0.2

    CRAN release: 2022-08-06

    • fix typo in lead() argument default
    • Add citation
    - +

    ferrn 0.0.1

    CRAN release: 2021-03-17

    • Added a NEWS.md file to track changes to the package.
    -
    +
    - +
    - -
    - +
    diff --git a/docs/pkgdown.css b/docs/pkgdown.css deleted file mode 100644 index 80ea5b8..0000000 --- a/docs/pkgdown.css +++ /dev/null @@ -1,384 +0,0 @@ -/* Sticky footer */ - -/** - * Basic idea: https://philipwalton.github.io/solved-by-flexbox/demos/sticky-footer/ - * Details: https://github.com/philipwalton/solved-by-flexbox/blob/master/assets/css/components/site.css - * - * .Site -> body > .container - * .Site-content -> body > .container .row - * .footer -> footer - * - * Key idea seems to be to ensure that .container and __all its parents__ - * have height set to 100% - * - */ - -html, body { - height: 100%; -} - -body { - position: relative; -} - -body > .container { - display: flex; - height: 100%; - flex-direction: column; -} - -body > .container .row { - flex: 1 0 auto; -} - -footer { - margin-top: 45px; - padding: 35px 0 36px; - border-top: 1px solid #e5e5e5; - color: #666; - display: flex; - flex-shrink: 0; -} -footer p { - margin-bottom: 0; -} -footer div { - flex: 1; -} -footer .pkgdown { - text-align: right; -} -footer p { - margin-bottom: 0; -} - -img.icon { - float: right; -} - -/* Ensure in-page images don't run outside their container */ -.contents img { - max-width: 100%; - height: auto; -} - -/* Fix bug in bootstrap (only seen in firefox) */ -summary { - display: list-item; -} - -/* Typographic tweaking ---------------------------------*/ - -.contents .page-header { - margin-top: calc(-60px + 1em); -} - -dd { - margin-left: 3em; -} - -/* Section anchors ---------------------------------*/ - -a.anchor { - display: none; - margin-left: 5px; - width: 20px; - height: 20px; - - background-image: url(./link.svg); - background-repeat: no-repeat; - background-size: 20px 20px; - background-position: center center; -} - -h1:hover .anchor, -h2:hover .anchor, -h3:hover .anchor, -h4:hover .anchor, -h5:hover .anchor, -h6:hover .anchor { - display: inline-block; -} - -/* Fixes for fixed navbar --------------------------*/ - -.contents h1, .contents h2, .contents h3, .contents h4 { - padding-top: 60px; - margin-top: -40px; -} - -/* Navbar submenu --------------------------*/ - -.dropdown-submenu { - position: relative; -} - -.dropdown-submenu>.dropdown-menu { - top: 0; - left: 100%; - margin-top: -6px; - margin-left: -1px; - border-radius: 0 6px 6px 6px; -} - -.dropdown-submenu:hover>.dropdown-menu { - display: block; -} - -.dropdown-submenu>a:after { - display: block; - content: " "; - float: right; - width: 0; - height: 0; - border-color: transparent; - border-style: solid; - border-width: 5px 0 5px 5px; - border-left-color: #cccccc; - margin-top: 5px; - margin-right: -10px; -} - -.dropdown-submenu:hover>a:after { - border-left-color: #ffffff; -} - -.dropdown-submenu.pull-left { - float: none; -} - -.dropdown-submenu.pull-left>.dropdown-menu { - left: -100%; - margin-left: 10px; - border-radius: 6px 0 6px 6px; -} - -/* Sidebar --------------------------*/ - -#pkgdown-sidebar { - margin-top: 30px; - position: -webkit-sticky; - position: sticky; - top: 70px; -} - -#pkgdown-sidebar h2 { - font-size: 1.5em; - margin-top: 1em; -} - -#pkgdown-sidebar h2:first-child { - margin-top: 0; -} - -#pkgdown-sidebar .list-unstyled li { - margin-bottom: 0.5em; -} - -/* bootstrap-toc tweaks ------------------------------------------------------*/ - -/* All levels of nav */ - -nav[data-toggle='toc'] .nav > li > a { - padding: 4px 20px 4px 6px; - font-size: 1.5rem; - font-weight: 400; - color: inherit; -} - -nav[data-toggle='toc'] .nav > li > a:hover, -nav[data-toggle='toc'] .nav > li > a:focus { - padding-left: 5px; - color: inherit; - border-left: 1px solid #878787; -} - -nav[data-toggle='toc'] .nav > .active > a, -nav[data-toggle='toc'] .nav > .active:hover > a, -nav[data-toggle='toc'] .nav > .active:focus > a { - padding-left: 5px; - font-size: 1.5rem; - font-weight: 400; - color: inherit; - border-left: 2px solid #878787; -} - -/* Nav: second level (shown on .active) */ - -nav[data-toggle='toc'] .nav .nav { - display: none; /* Hide by default, but at >768px, show it */ - padding-bottom: 10px; -} - -nav[data-toggle='toc'] .nav .nav > li > a { - padding-left: 16px; - font-size: 1.35rem; -} - -nav[data-toggle='toc'] .nav .nav > li > a:hover, -nav[data-toggle='toc'] .nav .nav > li > a:focus { - padding-left: 15px; -} - -nav[data-toggle='toc'] .nav .nav > .active > a, -nav[data-toggle='toc'] .nav .nav > .active:hover > a, -nav[data-toggle='toc'] .nav .nav > .active:focus > a { - padding-left: 15px; - font-weight: 500; - font-size: 1.35rem; -} - -/* orcid ------------------------------------------------------------------- */ - -.orcid { - font-size: 16px; - color: #A6CE39; - /* margins are required by official ORCID trademark and display guidelines */ - margin-left:4px; - margin-right:4px; - vertical-align: middle; -} - -/* Reference index & topics ----------------------------------------------- */ - -.ref-index th {font-weight: normal;} - -.ref-index td {vertical-align: top; min-width: 100px} -.ref-index .icon {width: 40px;} -.ref-index .alias {width: 40%;} -.ref-index-icons .alias {width: calc(40% - 40px);} -.ref-index .title {width: 60%;} - -.ref-arguments th {text-align: right; padding-right: 10px;} -.ref-arguments th, .ref-arguments td {vertical-align: top; min-width: 100px} -.ref-arguments .name {width: 20%;} -.ref-arguments .desc {width: 80%;} - -/* Nice scrolling for wide elements --------------------------------------- */ - -table { - display: block; - overflow: auto; -} - -/* Syntax highlighting ---------------------------------------------------- */ - -pre, code, pre code { - background-color: #f8f8f8; - color: #333; -} -pre, pre code { - white-space: pre-wrap; - word-break: break-all; - overflow-wrap: break-word; -} - -pre { - border: 1px solid #eee; -} - -pre .img, pre .r-plt { - margin: 5px 0; -} - -pre .img img, pre .r-plt img { - background-color: #fff; -} - -code a, pre a { - color: #375f84; -} - -a.sourceLine:hover { - text-decoration: none; -} - -.fl {color: #1514b5;} -.fu {color: #000000;} /* function */ -.ch,.st {color: #036a07;} /* string */ -.kw {color: #264D66;} /* keyword */ -.co {color: #888888;} /* comment */ - -.error {font-weight: bolder;} -.warning {font-weight: bolder;} - -/* Clipboard --------------------------*/ - -.hasCopyButton { - position: relative; -} - -.btn-copy-ex { - position: absolute; - right: 0; - top: 0; - visibility: hidden; -} - -.hasCopyButton:hover button.btn-copy-ex { - visibility: visible; -} - -/* headroom.js ------------------------ */ - -.headroom { - will-change: transform; - transition: transform 200ms linear; -} -.headroom--pinned { - transform: translateY(0%); -} -.headroom--unpinned { - transform: translateY(-100%); -} - -/* mark.js ----------------------------*/ - -mark { - background-color: rgba(255, 255, 51, 0.5); - border-bottom: 2px solid rgba(255, 153, 51, 0.3); - padding: 1px; -} - -/* vertical spacing after htmlwidgets */ -.html-widget { - margin-bottom: 10px; -} - -/* fontawesome ------------------------ */ - -.fab { - font-family: "Font Awesome 5 Brands" !important; -} - -/* don't display links in code chunks when printing */ -/* source: https://stackoverflow.com/a/10781533 */ -@media print { - code a:link:after, code a:visited:after { - content: ""; - } -} - -/* Section anchors --------------------------------- - Added in pandoc 2.11: https://github.com/jgm/pandoc-templates/commit/9904bf71 -*/ - -div.csl-bib-body { } -div.csl-entry { - clear: both; -} -.hanging-indent div.csl-entry { - margin-left:2em; - text-indent:-2em; -} -div.csl-left-margin { - min-width:2em; - float:left; -} -div.csl-right-inline { - margin-left:2em; - padding-left:1em; -} -div.csl-indent { - margin-left: 2em; -} diff --git a/docs/pkgdown.js b/docs/pkgdown.js index 6f0eee4..9757bf9 100644 --- a/docs/pkgdown.js +++ b/docs/pkgdown.js @@ -2,83 +2,43 @@ (function($) { $(function() { - $('.navbar-fixed-top').headroom(); + $('nav.navbar').headroom(); - $('body').css('padding-top', $('.navbar').height() + 10); - $(window).resize(function(){ - $('body').css('padding-top', $('.navbar').height() + 10); + Toc.init({ + $nav: $("#toc"), + $scope: $("main h2, main h3, main h4, main h5, main h6") }); - $('[data-toggle="tooltip"]').tooltip(); - - var cur_path = paths(location.pathname); - var links = $("#navbar ul li a"); - var max_length = -1; - var pos = -1; - for (var i = 0; i < links.length; i++) { - if (links[i].getAttribute("href") === "#") - continue; - // Ignore external links - if (links[i].host !== location.host) - continue; - - var nav_path = paths(links[i].pathname); - - var length = prefix_length(nav_path, cur_path); - if (length > max_length) { - max_length = length; - pos = i; - } - } - - // Add class to parent
  • , and enclosing
  • if in dropdown - if (pos >= 0) { - var menu_anchor = $(links[pos]); - menu_anchor.parent().addClass("active"); - menu_anchor.closest("li.dropdown").addClass("active"); - } - }); - - function paths(pathname) { - var pieces = pathname.split("/"); - pieces.shift(); // always starts with / - - var end = pieces[pieces.length - 1]; - if (end === "index.html" || end === "") - pieces.pop(); - return(pieces); - } - - // Returns -1 if not found - function prefix_length(needle, haystack) { - if (needle.length > haystack.length) - return(-1); - - // Special case for length-0 haystack, since for loop won't run - if (haystack.length === 0) { - return(needle.length === 0 ? 0 : -1); + if ($('#toc').length) { + $('body').scrollspy({ + target: '#toc', + offset: $("nav.navbar").outerHeight() + 1 + }); } - for (var i = 0; i < haystack.length; i++) { - if (needle[i] != haystack[i]) - return(i); - } + // Activate popovers + $('[data-bs-toggle="popover"]').popover({ + container: 'body', + html: true, + trigger: 'focus', + placement: "top", + sanitize: false, + }); - return(haystack.length); - } + $('[data-bs-toggle="tooltip"]').tooltip(); /* Clipboard --------------------------*/ function changeTooltipMessage(element, msg) { - var tooltipOriginalTitle=element.getAttribute('data-original-title'); - element.setAttribute('data-original-title', msg); + var tooltipOriginalTitle=element.getAttribute('data-bs-original-title'); + element.setAttribute('data-bs-original-title', msg); $(element).tooltip('show'); - element.setAttribute('data-original-title', tooltipOriginalTitle); + element.setAttribute('data-bs-original-title', tooltipOriginalTitle); } if(ClipboardJS.isSupported()) { $(document).ready(function() { - var copyButton = ""; + var copyButton = ""; $("div.sourceCode").addClass("hasCopyButton"); @@ -89,20 +49,106 @@ $('.btn-copy-ex').tooltip({container: 'body'}); // Initialize clipboard: - var clipboardBtnCopies = new ClipboardJS('[data-clipboard-copy]', { + var clipboard = new ClipboardJS('[data-clipboard-copy]', { text: function(trigger) { return trigger.parentNode.textContent.replace(/\n#>[^\n]*/g, ""); } }); - clipboardBtnCopies.on('success', function(e) { + clipboard.on('success', function(e) { changeTooltipMessage(e.trigger, 'Copied!'); e.clearSelection(); }); - clipboardBtnCopies.on('error', function() { + clipboard.on('error', function(e) { changeTooltipMessage(e.trigger,'Press Ctrl+C or Command+C to copy'); }); + }); } + + /* Search marking --------------------------*/ + var url = new URL(window.location.href); + var toMark = url.searchParams.get("q"); + var mark = new Mark("main#main"); + if (toMark) { + mark.mark(toMark, { + accuracy: { + value: "complementary", + limiters: [",", ".", ":", "/"], + } + }); + } + + /* Search --------------------------*/ + /* Adapted from https://github.com/rstudio/bookdown/blob/2d692ba4b61f1e466c92e78fd712b0ab08c11d31/inst/resources/bs4_book/bs4_book.js#L25 */ + // Initialise search index on focus + var fuse; + $("#search-input").focus(async function(e) { + if (fuse) { + return; + } + + $(e.target).addClass("loading"); + var response = await fetch($("#search-input").data("search-index")); + var data = await response.json(); + + var options = { + keys: ["what", "text", "code"], + ignoreLocation: true, + threshold: 0.1, + includeMatches: true, + includeScore: true, + }; + fuse = new Fuse(data, options); + + $(e.target).removeClass("loading"); + }); + + // Use algolia autocomplete + var options = { + autoselect: true, + debug: true, + hint: false, + minLength: 2, + }; + var q; +async function searchFuse(query, callback) { + await fuse; + + var items; + if (!fuse) { + items = []; + } else { + q = query; + var results = fuse.search(query, { limit: 20 }); + items = results + .filter((x) => x.score <= 0.75) + .map((x) => x.item); + if (items.length === 0) { + items = [{dir:"Sorry 😿",previous_headings:"",title:"No results found.",what:"No results found.",path:window.location.href}]; + } + } + callback(items); +} + $("#search-input").autocomplete(options, [ + { + name: "content", + source: searchFuse, + templates: { + suggestion: (s) => { + if (s.title == s.what) { + return `${s.dir} >
    ${s.title}
    `; + } else if (s.previous_headings == "") { + return `${s.dir} >
    ${s.title}
    > ${s.what}`; + } else { + return `${s.dir} >
    ${s.title}
    > ${s.previous_headings} > ${s.what}`; + } + }, + }, + }, + ]).on('autocomplete:selected', function(event, s) { + window.location.href = s.path + "?q=" + q + "#" + s.id; + }); + }); })(window.jQuery || window.$) diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index 5acbd11..ccb4470 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -2,7 +2,7 @@ pandoc: 3.2.1 pkgdown: 2.1.0 pkgdown_sha: ~ articles: {} -last_built: 2024-09-10T20:30Z +last_built: 2024-09-12T14:32Z urls: reference: https://huizezhang-sherry.github.io/ferrn/reference article: https://huizezhang-sherry.github.io/ferrn/articles diff --git a/docs/reference/add_anchor.html b/docs/reference/add_anchor.html index fa4f4bf..b29b182 100644 --- a/docs/reference/add_anchor.html +++ b/docs/reference/add_anchor.html @@ -1,71 +1,51 @@ -A ggproto for drawing anchor points — add_anchor • ferrn - - -
    -
    -
    - +
    +
    +
    -
    +

    This is a wrapper function used by explore_space_pca() and should be be called directly by the user

    -
    +
    +

    Usage

    add_anchor(dt, anchor_size = 3, anchor_alpha = 0.5, anchor_color = NULL, ...)
    -
    -

    Arguments

    +
    +

    Arguments

    dt
    @@ -88,12 +68,12 @@

    Arguments

    other aesthetics inherent from explore_space_pca()

    -
    -

    Value

    +
    +

    Value

    a wrapper for drawing anchor points in explore_space_pca()

    -
    -

    See also

    +
    +

    See also

    Other draw functions: add_anno(), add_dir_search(), @@ -107,23 +87,19 @@

    See also

    add_theo()

    -
    - -
    +
    -
    - +
    diff --git a/docs/reference/add_anno.html b/docs/reference/add_anno.html index 9782bbf..8632923 100644 --- a/docs/reference/add_anno.html +++ b/docs/reference/add_anno.html @@ -1,71 +1,51 @@ -A ggproto for annotating the symmetry of the starting points — add_anno • ferrn - - -
    -
    -
    - +
    +
    +
    -
    +

    This is a wrapper function used by explore_space_pca() and should be be called directly by the user

    -
    +
    +

    Usage

    add_anno(dt, anno_color = "black", anno_lty = "dashed", anno_alpha = 0.1, ...)
    -
    -

    Arguments

    +
    +

    Arguments

    dt
    @@ -88,12 +68,12 @@

    Arguments

    other aesthetics inherent from explore_space_pca()

    -
    -

    Value

    +
    +

    Value

    a wrapper for annotating the symmetry of start points in explore_space_pca()

    -
    -

    See also

    +
    +

    See also

    Other draw functions: add_anchor(), add_dir_search(), @@ -107,23 +87,19 @@

    See also

    add_theo()

    -
    - -
    +
    -
    - +
    diff --git a/docs/reference/add_dir_search.html b/docs/reference/add_dir_search.html index 5e3fe3d..6322187 100644 --- a/docs/reference/add_dir_search.html +++ b/docs/reference/add_dir_search.html @@ -1,71 +1,51 @@ -A ggproto for drawing directional search points — add_dir_search • ferrn - - -
    -
    -
    - +
    +
    +
    -
    +

    This is a wrapper function used by explore_space_pca() and should be be called directly by the user

    -
    +
    +

    Usage

    add_dir_search(dt, dir_size = 0.5, dir_alpha = 0.5, dir_color = NULL, ...)
    -
    -

    Arguments

    +
    +

    Arguments

    dt
    @@ -88,12 +68,12 @@

    Arguments

    other aesthetics inherent from explore_space_pca()

    -
    -

    Value

    +
    +

    Value

    a wrapper for drawing directional search points (used in pseudo derivative search) with buffer in explore_space_pca()

    -
    -

    See also

    +
    +

    See also

    Other draw functions: add_anchor(), add_anno(), @@ -107,23 +87,19 @@

    See also

    add_theo()

    -
    - -
    +
    -
    - +
    diff --git a/docs/reference/add_end.html b/docs/reference/add_end.html index 070d2e7..e7685c5 100644 --- a/docs/reference/add_end.html +++ b/docs/reference/add_end.html @@ -1,71 +1,51 @@ -A ggproto for drawing start points — add_end • ferrn - - -
    -
    -
    - +
    +
    +
    -
    +

    This is a wrapper function used by explore_space_pca() and should be be called directly by the user

    -
    +
    +

    Usage

    add_end(dt, end_size = 5, end_alpha = 1, end_color = NULL, ...)
    -
    -

    Arguments

    +
    +

    Arguments

    dt
    @@ -88,12 +68,12 @@

    Arguments

    other aesthetics inherent from explore_space_pca()

    -
    -

    Value

    +
    +

    Value

    a wrapper for drawing end points in explore_space_pca()

    -
    -

    See also

    +
    +

    See also

    Other draw functions: add_anchor(), add_anno(), @@ -107,23 +87,19 @@

    See also

    add_theo()

    -
    - -
    +
    -
    - +
    diff --git a/docs/reference/add_interp.html b/docs/reference/add_interp.html index 77fbf2e..cdb24f2 100644 --- a/docs/reference/add_interp.html +++ b/docs/reference/add_interp.html @@ -1,66 +1,46 @@ -A ggproto for drawing interpolation path — add_interp • ferrn - - -
    -
    -
    - +
    +
    +
    -
    +

    This is a wrapper function used by explore_space_pca() and should be be called directly by the user

    -
    +
    +

    Usage

    add_interp(
       dt,
       interp_size = 1.5,
    @@ -71,8 +51,8 @@ 

    A ggproto for drawing interpolation path

    )
    -
    -

    Arguments

    +
    +

    Arguments

    dt
    @@ -99,12 +79,12 @@

    Arguments

    other aesthetics inherent from explore_space_pca()

    -
    -

    Value

    +
    +

    Value

    a wrapper for drawing the interpolation points in explore_space_pca()

    -
    -

    See also

    +
    +

    See also

    Other draw functions: add_anchor(), add_anno(), @@ -118,23 +98,19 @@

    See also

    add_theo()

    -
    - -
    +
    -
    - +
    diff --git a/docs/reference/add_interp_last.html b/docs/reference/add_interp_last.html index 9d015b8..8cbce72 100644 --- a/docs/reference/add_interp_last.html +++ b/docs/reference/add_interp_last.html @@ -1,66 +1,46 @@ -A ggproto for drawing finish points — add_interp_last • ferrn - - -
    -
    -
    - +
    +
    +
    -
    +

    This is a wrapper function used by explore_space_pca() and should be be called directly by the user

    -
    +
    +

    Usage

    add_interp_last(
       dt,
       interp_last_size = 3,
    @@ -70,8 +50,8 @@ 

    A ggproto for drawing finish points

    )
    -
    -

    Arguments

    +
    +

    Arguments

    dt
    @@ -94,12 +74,12 @@

    Arguments

    other aesthetics inherent from explore_space_pca()

    -
    -

    Value

    +
    +

    Value

    a wrapper for drawing the last interpolation points of each iteration in explore_space_pca()

    -
    -

    See also

    +
    +

    See also

    Other draw functions: add_anchor(), add_anno(), @@ -113,23 +93,19 @@

    See also

    add_theo()

    -
    - -
    +
    -
    - +
    diff --git a/docs/reference/add_interrupt.html b/docs/reference/add_interrupt.html index 2d95629..56894cf 100644 --- a/docs/reference/add_interrupt.html +++ b/docs/reference/add_interrupt.html @@ -1,66 +1,46 @@ -A ggproto for annotating the interrupted path — add_interrupt • ferrn - - -
    -
    -
    - +
    +
    +
    -
    +

    This is a wrapper function used by explore_space_pca() and should be be called directly by the user

    -
    +
    +

    Usage

    add_interrupt(
       dt,
       interrupt_size = 0.5,
    @@ -72,8 +52,8 @@ 

    A ggproto for annotating the interrupted path

    )
    -
    -

    Arguments

    +
    +

    Arguments

    dt
    @@ -104,12 +84,12 @@

    Arguments

    other aesthetics inherent from explore_space_pca()

    -
    -

    Value

    +
    +

    Value

    a wrapper for annotating the interruption in explore_space_pca()

    -
    -

    See also

    +
    +

    See also

    Other draw functions: add_anchor(), add_anno(), @@ -123,23 +103,19 @@

    See also

    add_theo()

    -
    - -
    +
    -
    - +
    diff --git a/docs/reference/add_search.html b/docs/reference/add_search.html index 728e1ed..9189721 100644 --- a/docs/reference/add_search.html +++ b/docs/reference/add_search.html @@ -1,71 +1,51 @@ -A ggproto for drawing search points — add_search • ferrn - - -
    -
    -
    - +
    +
    +
    -
    +

    This is a wrapper function used by explore_space_pca() and should be be called directly by the user

    -
    +
    +

    Usage

    add_search(dt, search_size = 0.5, search_alpha = 0.5, search_color = NULL, ...)
    -
    -

    Arguments

    +
    +

    Arguments

    dt
    @@ -88,12 +68,12 @@

    Arguments

    other aesthetics inherent from explore_space_pca()

    -
    -

    Value

    +
    +

    Value

    a wrapper for drawing search points in explore_space_pca()

    -
    -

    See also

    +
    +

    See also

    Other draw functions: add_anchor(), add_anno(), @@ -107,23 +87,19 @@

    See also

    add_theo()

    -
    - -
    +
    -
    - +
    diff --git a/docs/reference/add_space.html b/docs/reference/add_space.html index 388964c..ecc1859 100644 --- a/docs/reference/add_space.html +++ b/docs/reference/add_space.html @@ -1,66 +1,46 @@ -A ggproto for drawing circle — add_space • ferrn - - -
    -
    -
    - +
    +
    +
    -
    +

    This is a wrapper function used by explore_space_pca() and should be be called directly by the user

    -
    +
    +

    Usage

    add_space(
       dt,
       space_alpha = 0.5,
    @@ -73,8 +53,8 @@ 

    A ggproto for drawing circle

    )
    -
    -

    Arguments

    +
    +

    Arguments

    dt
    @@ -109,12 +89,12 @@

    Arguments

    other aesthetics inherent from explore_space_pca()

    -
    -

    Value

    +
    +

    Value

    a wrapper for drawing the space in explore_space_pca()

    -
    -

    See also

    +
    +

    See also

    Other draw functions: add_anchor(), add_anno(), @@ -128,8 +108,8 @@

    See also

    add_theo()

    -
    -

    Examples

    +
    +

    Examples

    library(ggplot2)
     space <- tibble::tibble(x0 = 0, y0 = 0, r = 5)
     ggplot() +
    @@ -139,23 +119,19 @@ 

    Examples

    -
    - -
    +
    -
    - +
    diff --git a/docs/reference/add_start-1.png b/docs/reference/add_start-1.png deleted file mode 100644 index 9e46994..0000000 Binary files a/docs/reference/add_start-1.png and /dev/null differ diff --git a/docs/reference/add_start.html b/docs/reference/add_start.html index 2113215..d23bf27 100644 --- a/docs/reference/add_start.html +++ b/docs/reference/add_start.html @@ -1,71 +1,51 @@ -A ggproto for drawing start points — add_start • ferrn - - -
    -
    -
    - +
    +
    +
    -
    +

    This is a wrapper function used by explore_space_pca() and should be be called directly by the user

    -
    +
    +

    Usage

    add_start(dt, start_size = 5, start_alpha = 1, start_color = NULL, ...)
    -
    -

    Arguments

    +
    +

    Arguments

    dt
    @@ -88,12 +68,12 @@

    Arguments

    other aesthetics inherent from explore_space_pca()

    -
    -

    Value

    +
    +

    Value

    a wrapper for drawing start points in explore_space_pca()

    -
    -

    See also

    +
    +

    See also

    Other draw functions: add_anchor(), add_anno(), @@ -107,8 +87,8 @@

    See also

    add_theo()

    -
    -

    Examples

    +
    +

    Examples

    library(ggplot2)
     # construct the space and start df for plotting
     space <- tibble::tibble(x0 = 0, y0 = 0, r = 5)
    @@ -124,23 +104,19 @@ 

    Examples

    #> # ℹ 3 more variables: PC3 <dbl>, PC4 <dbl>, PC5 <dbl>
    -
    - -
    +
    -
    - +
    diff --git a/docs/reference/add_theo.html b/docs/reference/add_theo.html index 44dba30..84d7db7 100644 --- a/docs/reference/add_theo.html +++ b/docs/reference/add_theo.html @@ -1,66 +1,46 @@ -A ggproto for drawing the theoretical basis, if applicable — add_theo • ferrn - - -
    -
    -
    - +
    +
    +
    -
    +

    This is a wrapper function used by explore_space_pca() and should be be called directly by the user

    -
    +
    +

    Usage

    add_theo(
       dt,
       theo_label = "*",
    @@ -71,8 +51,8 @@ 

    A ggproto for drawing the theoretical basis, if applicable

    )
    -
    -

    Arguments

    +
    +

    Arguments

    dt
    @@ -99,12 +79,12 @@

    Arguments

    other aesthetics inherent from explore_space_pca()

    -
    -

    Value

    +
    +

    Value

    a wrapper for drawing theoretical points in explore_space_pca()

    -
    -

    See also

    +
    +

    See also

    Other draw functions: add_anchor(), add_anno(), @@ -118,23 +98,19 @@

    See also

    add_start()

    -
    - -
    +
    -
    - +
    diff --git a/docs/reference/bind_random.html b/docs/reference/bind_random.html index 41e0185..c0e69a1 100644 --- a/docs/reference/bind_random.html +++ b/docs/reference/bind_random.html @@ -1,71 +1,51 @@ -Bind random bases in the projection bases space — bind_random • ferrn - - -
    -
    -
    - +
    +
    +
    -
    +

    Given the orthonormality constraint, the projection bases live in a high dimensional hollow sphere. Generating random points on the sphere is useful to perceive the data object in the high dimensional space.

    -
    +
    +

    Usage

    bind_random(dt, n = 500, seed = 1)
    -
    -

    Arguments

    +
    +

    Arguments

    dt
    @@ -80,19 +60,19 @@

    Arguments

    numeric; a seed for generating reproducible random bases from geozoo

    -
    -

    Value

    +
    +

    Value

    a tibble object containing both the searched and random bases

    -
    -

    See also

    +
    +

    See also

    -
    -

    Examples

    +
    +

    Examples

    bind_random(holes_1d_better) %>% tail(5)
     #> # A tibble: 5 × 8
     #>   basis         index_val info               method      alpha tries  loop    id
    @@ -104,23 +84,19 @@ 

    Examples

    #> 5 <dbl [5 × 1]> NA randomly_generated randomly_g… NA NA NA 0
    -
    - -
    +
    -
    - +
    diff --git a/docs/reference/bind_random_matrix.html b/docs/reference/bind_random_matrix.html index 1775b04..3509916 100644 --- a/docs/reference/bind_random_matrix.html +++ b/docs/reference/bind_random_matrix.html @@ -1,69 +1,48 @@ -Bind random bases in the projection bases space as a matrix — bind_random_matrix • ferrn - - -
    -
    -
    - +
    +
    +
    -
    +

    Bind random bases in the projection bases space as a matrix

    -
    +
    +

    Usage

    bind_random_matrix(basis, n = 500, d = 1, front = FALSE, seed = 1)
    -
    -

    Arguments

    +
    +

    Arguments

    basis
    @@ -86,20 +65,20 @@

    Arguments

    numeric; a seed for generating reproducible random bases from geozoo

    -
    -

    Value

    +
    +

    Value

    matrix

    a matrix containing both the searched and random bases

    -
    -

    See also

    +
    +

    See also

    Other bind: bind_random(), bind_theoretical()

    -
    -

    Examples

    +
    +

    Examples

    data <- get_basis_matrix(holes_1d_geo)
     bind_random_matrix(data) %>% tail(5)
     #>                 V1          V2          V3          V4         V5
    @@ -110,23 +89,19 @@ 

    Examples

    #> [916,] -0.07483644 -0.58095640 0.06165148 -0.56242581 -0.5803150
    -
    - -
    +
    -
    - +
    diff --git a/docs/reference/bind_theoretical.html b/docs/reference/bind_theoretical.html index 42e7cb7..6b9bf0d 100644 --- a/docs/reference/bind_theoretical.html +++ b/docs/reference/bind_theoretical.html @@ -1,71 +1,51 @@ -Bind the theoretical best record — bind_theoretical • ferrn - - -
    -
    -
    - +
    +
    +
    -
    +

    The theoretical best basis is usually known for a simulated problem. Augment this information into the data object allows for evaluating the performance of optimisation against the theory.

    -
    +
    +

    Usage

    bind_theoretical(dt, matrix, index, raw_data)
    -
    -

    Arguments

    +
    +

    Arguments

    dt
    @@ -84,19 +64,19 @@

    Arguments

    a tibble of the original data used to calculate the index value

    -
    -

    Value

    +
    +

    Value

    a tibble object containing both the searched and theoretical best bases

    -
    -

    See also

    +
    +

    See also

    -
    -

    Examples

    +
    +

    Examples

    best <- matrix(c(0, 1, 0, 0, 0), nrow = 5)
     tail(holes_1d_better %>% bind_theoretical(best, tourr::holes(), raw_data = boa5), 1)
     #> # A tibble: 1 × 8
    @@ -105,23 +85,19 @@ 

    Examples

    #> 1 <dbl [5 × 1]> 0.931 theoretical NA NA NA NA 0
    -
    - -
    +
    -
    - +
    diff --git a/docs/reference/color.html b/docs/reference/color.html index 6c8cd32..10e23c0 100644 --- a/docs/reference/color.html +++ b/docs/reference/color.html @@ -1,75 +1,54 @@ -A customised colour palette based on Australian botanies — botanical_palettes • ferrn - - -
    -
    -
    - +
    +
    +
    -
    +

    Available colours in the palettes

    -
    +
    +

    Usage

    botanical_palettes
     
     botanical_pal(palette = "fern", reverse = FALSE)
    -
    -

    Format

    +
    +

    Format

    An object of class list of length 5.

    -
    -

    Arguments

    +
    +

    Arguments

    palette
    @@ -80,28 +59,24 @@

    Arguments

    logical, if the colour should be reversed

    -
    -

    Value

    +
    +

    Value

    a function for interpolating colour in the botanical palette

    -
    - -
    +
    -
    - +
    diff --git a/docs/reference/data-2.png b/docs/reference/data-2.png deleted file mode 100644 index ae9477e..0000000 Binary files a/docs/reference/data-2.png and /dev/null differ diff --git a/docs/reference/data-3.png b/docs/reference/data-3.png deleted file mode 100644 index b224e26..0000000 Binary files a/docs/reference/data-3.png and /dev/null differ diff --git a/docs/reference/data.html b/docs/reference/data.html index b640c76..578fcc1 100644 --- a/docs/reference/data.html +++ b/docs/reference/data.html @@ -1,66 +1,46 @@ -Data objects collected during the projection pursuit optimisation — holes_1d_geo • ferrn - - -
    -
    -
    - +
    +
    +
    -
    +

    Simulated data to demonstrate the usage of four diagnostic plots in the package, users can create their own guided tour data objects and diagnose with the visualisation designed in this package.

    -
    +
    +

    Usage

    holes_1d_geo
     
     holes_1d_better
    @@ -72,23 +52,23 @@ 

    Data objects collected during the projection pursuit optimisation

    holes_2d_better_max_tries
    -
    -

    Format

    +
    +

    Format

    An object of class tbl_df (inherits from tbl, data.frame) with 416 rows and 8 columns.

    An object of class tbl_df (inherits from tbl, data.frame) with 79 rows and 8 columns.

    An object of class tbl_df (inherits from tbl, data.frame) with 2500 rows and 8 columns.

    An object of class tbl_df (inherits from tbl, data.frame) with 98 rows and 8 columns.

    An object of class tbl_df (inherits from tbl, data.frame) with 1499 rows and 8 columns.

    -
    -

    Details

    +
    +

    Details

    The prefix holes_* indicates the use of holes index in the guided tour. The suffix *_better/geo/jellyfish indicates the optimiser used: search_better, search_geodesic, search_jellyfish.

    -
    -

    Examples

    +
    +

    Examples

    holes_1d_better %>%
     explore_trace_interp(interp_size = 2) +
       scale_color_continuous_botanical(palette = "fern")
    @@ -97,23 +77,19 @@ 

    Examples

    -
    - -
    +
    -
    - +
    diff --git a/docs/reference/explore_space_pca.html b/docs/reference/explore_space_pca.html index 16458f8..e88fd71 100644 --- a/docs/reference/explore_space_pca.html +++ b/docs/reference/explore_space_pca.html @@ -1,64 +1,43 @@ -Plot the PCA projection of the projection bases space — explore_space_start • ferrn - - -
    -
    -
    - +
    +
    +
    -
    +

    Plot the PCA projection of the projection bases space

    -
    +
    +

    Usage

    explore_space_start(dt, group = NULL, pca = TRUE, ...)
     
     explore_space_end(dt, group = NULL, pca = TRUE, ...)
    @@ -75,8 +54,8 @@ 

    Plot the PCA projection of the projection bases space

    )
    -
    -

    Arguments

    +
    +

    Arguments

    dt
    @@ -111,20 +90,20 @@

    Arguments

    logical; if the interpolation path needs to be animated

    -
    -

    Value

    +
    +

    Value

    a ggplot2 object

    -
    -

    See also

    +
    +

    See also

    -
    -

    Examples

    +
    +

    Examples

    dplyr::bind_rows(holes_1d_geo, holes_1d_better) %>%
       bind_theoretical(matrix(c(0, 1, 0, 0, 0), nrow = 5),
         index = tourr::holes(), raw_data = boa5
    @@ -147,23 +126,19 @@ 

    Examples

    } # }
    -
    - -
    +
    -
    - +
    diff --git a/docs/reference/explore_space_tour-1.png b/docs/reference/explore_space_tour-1.png deleted file mode 100644 index ffd3177..0000000 Binary files a/docs/reference/explore_space_tour-1.png and /dev/null differ diff --git a/docs/reference/explore_space_tour.html b/docs/reference/explore_space_tour.html index 4daa712..48fbb40 100644 --- a/docs/reference/explore_space_tour.html +++ b/docs/reference/explore_space_tour.html @@ -1,64 +1,43 @@ -Plot the grand tour animation of the bases space in high dimension — explore_space_tour • ferrn - - -
    -
    -
    - +
    +
    +
    -
    +

    Plot the grand tour animation of the bases space in high dimension

    -
    +
    +

    Usage

    explore_space_tour(..., axes = "bottomleft")
     
     prep_space_tour(
    @@ -79,8 +58,8 @@ 

    Plot the grand tour animation of the bases space in high dimension

    )
    -
    -

    Arguments

    +
    +

    Arguments

    ...
    @@ -143,8 +122,8 @@

    Arguments

    the colour palette to be used

    -
    -

    Value

    +
    +

    Value

    explore_space_tour()

    an animation of the search path in the high-dimensional sphere

    @@ -154,42 +133,36 @@

    Value

    -
    -

    See also

    +
    +

    See also

    -
    -

    Examples

    -
    explore_space_tour(dplyr::bind_rows(holes_1d_better, holes_1d_geo),
    +    
    +

    Examples

    +
    if (FALSE){
    +explore_space_tour(dplyr::bind_rows(holes_1d_better, holes_1d_geo),
       group = method, palette = botanical_palettes$fern[c(1, 6)]
     )
    -#> map method to color
    -#> Using half_range 1.1
    -
    -
    +}
     
    -
    - -
    +
    -
    - +
    diff --git a/docs/reference/explore_trace.html b/docs/reference/explore_trace.html index 999dc7c..6bdc74c 100644 --- a/docs/reference/explore_trace.html +++ b/docs/reference/explore_trace.html @@ -1,64 +1,43 @@ -Plot the trace the search progression — explore_trace_interp • ferrn - - -
    -
    -
    - +
    +
    +
    -
    +

    Trace the index value of search/ interpolation points in guided tour optimisation

    -
    +
    +

    Usage

    explore_trace_interp(
       dt,
       iter = NULL,
    @@ -72,8 +51,8 @@ 

    Plot the trace the search progression

    )
    -
    -

    Arguments

    +
    +

    Arguments

    dt
    @@ -112,20 +91,20 @@

    Arguments

    numeric; the precision of y-axis label

    -
    -

    Value

    +
    +

    Value

    a ggplot object for diagnosing how the index value progresses during the interpolation

    -
    -

    See also

    +
    +

    See also

    -
    -

    Examples

    +
    +

    Examples

    # Compare the trace of interpolated points in two algorithms
     holes_1d_better %>%
       explore_trace_interp(interp_size = 2) +
    @@ -135,23 +114,19 @@ 

    Examples

    -
    - -
    +
    -
    - +
    diff --git a/docs/reference/explore_trace_search.html b/docs/reference/explore_trace_search.html index 570cb56..6a232e9 100644 --- a/docs/reference/explore_trace_search.html +++ b/docs/reference/explore_trace_search.html @@ -1,64 +1,43 @@ -Plot the count in each iteration — explore_trace_search • ferrn - - -
    -
    -
    - +
    +
    +
    -
    +

    Plot the count in each iteration

    -
    +
    +

    Usage

    explore_trace_search(
       dt,
       iter = NULL,
    @@ -69,8 +48,8 @@ 

    Plot the count in each iteration

    )
    -
    -

    Arguments

    +
    +

    Arguments

    dt
    @@ -97,20 +76,20 @@

    Arguments

    arguments passed into geom_label_repel() for displaying text labels

    -
    -

    Value

    +
    +

    Value

    a ggplot object for diagnosing how many points the optimiser(s) have searched

    -
    -

    See also

    +
    +

    See also

    -
    -

    Examples

    +
    +

    Examples

    # Summary plots for search points in two algorithms
     library(patchwork)
     library(dplyr)
    @@ -143,23 +122,19 @@ 

    Examples

    -
    - -
    +
    -
    - +
    diff --git a/docs/reference/ferrn-package.html b/docs/reference/ferrn-package.html index a381bfb..9762453 100644 --- a/docs/reference/ferrn-package.html +++ b/docs/reference/ferrn-package.html @@ -1,74 +1,54 @@ -ferrn: Facilitate Exploration of touRR optimisatioN — ferrn-package • ferrn - - -
    -
    -
    - +
    +
    +
    -
    +

    Diagnostic plots for optimisation, with a focus on projection pursuit. These show paths the optimiser takes in the high-dimensional space in multiple ways: by reducing the dimension using principal component analysis, and also using the tour to show the path on the high-dimensional space. Several botanical colour palettes are included, reflecting the name of the package. A paper describing the methodology can be found at https://journal.r-project.org/archive/2021/RJ-2021-105/index.html.

    -
    -

    See also

    + -
    -

    Author

    +
    +

    Author

    Maintainer: H. Sherry Zhang huizezhangsh@gmail.com (ORCID)

    Authors:

    -
    - -
    +
    -
    - +
    diff --git a/docs/reference/format_label.html b/docs/reference/format_label.html index ed5a760..47cbe38 100644 --- a/docs/reference/format_label.html +++ b/docs/reference/format_label.html @@ -1,69 +1,48 @@ -Better label formatting to avoid overlapping — format_label • ferrn - - -
    -
    -
    - +
    +
    +
    -
    +

    Better label formatting to avoid overlapping

    -
    +
    +

    Usage

    format_label(labels, accuracy)
    -
    -

    Arguments

    +
    +

    Arguments

    labels
    @@ -74,36 +53,32 @@

    Arguments

    the accuracy of the label

    -
    -

    Value

    +
    +

    Value

    a vector of adjusted labels

    -
    -

    Examples

    +
    +

    Examples

    format_label(c(0.87, 0.87, 0.9, 0.93, 0.95), 0.01)
     #> [1] 0.87 0.90 0.93 0.95
     format_label(c(0.87, 0.87, 0.9, 0.93, 0.95, 0.96, 0.96), 0.01)
     #> [1] 0.87 0.90 0.93 0.95 0.96
     
    -
    - -
    +
    -
    - +
    diff --git a/docs/reference/get_best.html b/docs/reference/get_best.html deleted file mode 100644 index c439203..0000000 --- a/docs/reference/get_best.html +++ /dev/null @@ -1,126 +0,0 @@ - -Extract the record with the largest index value — get_best • ferrn - - -
    -
    - - - -
    -
    - - -
    -

    Extract the record with the largest index value

    -
    - -
    -
    get_best(dt, group = NULL)
    -
    - -
    -

    Arguments

    -
    dt
    -

    a data object collected by the projection pursuit guided tour optimisation in the tourr package

    -
    group
    -

    the variable to label different runs of the optimiser(s)

    -
    -
    -

    Value

    -

    a tibble object containing the best basis found by the optimiser(s)

    -
    -
    -

    See also

    - -
    - -
    -

    Examples

    -
    dplyr::bind_rows(holes_1d_better, holes_1d_geo) %>% get_best(group = method)
    -#> # A tibble: 2 × 8
    -#> # Groups:   method [2]
    -#>   basis         index_val info          method          alpha tries  loop    id
    -#>   <list>            <dbl> <chr>         <chr>           <dbl> <dbl> <dbl> <int>
    -#> 1 <dbl [5 × 1]>     0.914 interpolation search_better      NA     5     6    55
    -#> 2 <dbl [5 × 1]>     0.933 interpolation search_geodesic    NA     9     3   152
    -
    -
    -
    - -
    - - -
    - -
    -

    Site built with pkgdown 2.0.3.

    -
    - -
    - - - - - - - - diff --git a/docs/reference/index.html b/docs/reference/index.html index 7036edf..9d035c3 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -1,227 +1,317 @@ -Package index • ferrn - - -
    -
    -
    - +
    +
    +
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -

    Main plotting functions

    -

    Main diagnostic plotting functions

    -
    -

    explore_trace_search()

    -

    Plot the count in each iteration

    -

    explore_trace_interp()

    -

    Plot the trace the search progression

    -

    explore_space_start() explore_space_end() explore_space_pca()

    -

    Plot the PCA projection of the projection bases space

    -

    explore_space_tour() prep_space_tour()

    -

    Plot the grand tour animation of the bases space in high dimension

    -

    plot_projection() compute_projection()

    -

    Plot the projection from the optimisation data collected from projection pursuit

    -

    flip_sign() compute_pca()

    -

    Helper functions for `explore_space_pca()`

    -

    geom_huber() prep_huber() theme_huber()

    -

    Create Huber plot with ggplot2

    -

    Get components

    -

    Extracting components from existing data object

    -
    -

    get_best() get_start() get_interp() get_interp_last() get_anchor() get_search() get_dir_search() get_space_param() get_theo() get_interrupt() get_search_count() get_basis_matrix()

    -

    Functions to get components from the data collecting object

    -

    Bind additionals

    -

    Bind external data to the existing data object

    -
    -

    bind_random()

    -

    Bind random bases in the projection bases space

    -

    bind_random_matrix()

    -

    Bind random bases in the projection bases space as a matrix

    -

    bind_theoretical()

    -

    Bind the theoretical best record

    -

    Create ggprotos

    -

    ggproto for drawing each component in PCA plot

    -
    -

    add_anchor()

    -

    A ggproto for drawing anchor points

    -

    add_anno()

    -

    A ggproto for annotating the symmetry of the starting points

    -

    add_dir_search()

    -

    A ggproto for drawing directional search points

    -

    add_end()

    -

    A ggproto for drawing start points

    -

    add_interp()

    -

    A ggproto for drawing interpolation path

    -

    add_interp_last()

    -

    A ggproto for drawing finish points

    -

    add_interrupt()

    -

    A ggproto for annotating the interrupted path

    -

    add_search()

    -

    A ggproto for drawing search points

    -

    add_space()

    -

    A ggproto for drawing circle

    -

    add_start()

    -

    A ggproto for drawing start points

    -

    add_theo()

    -

    A ggproto for drawing the theoretical basis, if applicable

    -

    Color & theme

    -

    An australian botanical color palette

    -
    -

    botanical_palettes botanical_pal()

    -

    A customised colour palette based on Australian botanies

    -

    scale_color_continuous_botanical() scale_color_discrete_botanical() scale_fill_continuous_botanical() scale_fill_discrete_botanical()

    -

    continuous scale colour function

    -

    theme_fern()

    -

    A specific theme for trace plots

    -

    In-built data

    -

    Simulated example data

    -
    -

    sine1000 sine1000_8d pipe1000 pipe1000_8d pipe1000_10d pipe1000_12d boa boa5 boa6

    -

    Simulated sine, pipe, and gaussian mixture

    -

    holes_1d_geo holes_1d_better holes_1d_jellyfish holes_2d_better holes_2d_better_max_tries

    -

    Data objects collected during the projection pursuit optimisation

    -

    Calculate projection pursuit optimisation properties

    -

    -
    -

    sample_bases() print(<basis_df>) tbl_sum(<basis_df>) calc_smoothness() print(<smoothness_res>) tbl_sum(<smoothness_res>) calc_squintability() print(<squintability_res>) tbl_sum(<squintability_res>) fit_ks() fit_nls()

    -

    Function to calculate smoothness and squintability

    -

    Miscellaneous

    -

    Other misc functions

    -
    -

    clean_method()

    -

    Clean method names

    -

    format_label()

    -

    Better label formatting to avoid overlapping

    - - -
    +
    +

    Main plotting functions

    +

    Main diagnostic plotting functions

    + + +
    + + + + +
    + + explore_trace_search() + +
    +
    Plot the count in each iteration
    +
    + + explore_trace_interp() + +
    +
    Plot the trace the search progression
    +
    + + explore_space_start() explore_space_end() explore_space_pca() + +
    +
    Plot the PCA projection of the projection bases space
    +
    + + explore_space_tour() prep_space_tour() + +
    +
    Plot the grand tour animation of the bases space in high dimension
    +
    + + plot_projection() compute_projection() + +
    +
    Plot the projection from the optimisation data collected from projection pursuit
    +
    + + flip_sign() compute_pca() + +
    +
    Helper functions for `explore_space_pca()`
    +
    + + geom_huber() prep_huber() theme_huber() + +
    +
    Create Huber plot with ggplot2
    +
    +

    Calculate projection pursuit index metrics

    + + + + +
    +

    Get components

    + +

    Extracting components from existing data object

    + + +
    +

    Bind additionals

    + +

    Bind external data to the existing data object

    + + +
    + + + + +
    + + bind_random() + +
    +
    Bind random bases in the projection bases space
    +
    + + bind_random_matrix() + +
    +
    Bind random bases in the projection bases space as a matrix
    +
    + + bind_theoretical() + +
    +
    Bind the theoretical best record
    +
    +

    Create ggprotos

    + +

    ggproto for drawing each component in PCA plot

    -
    + + +
    -
    + +
    diff --git a/docs/reference/pipe.html b/docs/reference/pipe.html index e5fcf1c..22636ed 100644 --- a/docs/reference/pipe.html +++ b/docs/reference/pipe.html @@ -1,89 +1,64 @@ -Pipe operator — %>% • ferrn - - -
    -
    -
    - +
    +
    +
    -
    +

    See magrittr::%>% for details.

    -
    +
    +

    Usage

    lhs %>% rhs
    -
    -

    Value

    +
    +

    Value

    this is a magrittr pipe!

    -
    - -
    +
    -
    - +
    diff --git a/docs/reference/relevel.html b/docs/reference/relevel.html index 4cf1fc5..7e22cf2 100644 --- a/docs/reference/relevel.html +++ b/docs/reference/relevel.html @@ -1,82 +1,61 @@ -Clean method names — clean_method • ferrn - - -
    -
    -
    - +
    +
    +
    -
    +

    Clean method names

    -
    +
    +

    Usage

    clean_method(dt)
    -
    -

    Arguments

    +
    +

    Arguments

    dt

    a data object

    -
    -

    Value

    +
    +

    Value

    a tibble with method cleaned

    -
    -

    Examples

    +
    +

    Examples

    head(clean_method(holes_1d_better), 5)
     #> # A tibble: 5 × 8
     #>   basis         index_val info          method alpha tries  loop    id
    @@ -88,23 +67,19 @@ 

    Examples

    #> 5 <dbl [5 × 1]> 0.747 random_search CRS 0.5 2 4 5
    -
    - -
    +
    -
    - +
    diff --git a/docs/reference/scale.html b/docs/reference/scale.html index 8da27d2..69a1f8c 100644 --- a/docs/reference/scale.html +++ b/docs/reference/scale.html @@ -1,70 +1,52 @@ -continuous scale colour function — scale_color_continuous_botanical • ferrncontinuous scale colour function — scale_color_continuous_botanical • ferrn - - -
    -
    -
    - +
    +
    +
    -
    +

    continuous scale colour function

    Discrete scale colour function

    continuous scale fill function

    discrete scale fill function

    -
    +
    +

    Usage

    scale_color_continuous_botanical(palette = "fern", reverse = FALSE, ...)
     
     scale_color_discrete_botanical(palette = "fern", reverse = FALSE, ...)
    @@ -74,8 +56,8 @@ 

    continuous scale colour function

    scale_fill_discrete_botanical(palette = "fern", reverse = FALSE, ...)
    -
    -

    Arguments

    +
    +

    Arguments

    palette
    @@ -90,31 +72,27 @@

    Arguments

    other arguments passed into scale_color_gradientn

    -
    -

    Value

    +
    +

    Value

    a wrapper for continuous scales in the botanical palette

    a wrapper for discrete scales in the botanical palette

    a wrapper for continuous fill in the botanical palette

    a wrapper for discrete fill in the botanical palette

    -
    - -
    +
    -
    - +
    diff --git a/docs/reference/theme_fern.html b/docs/reference/theme_fern.html index 674607c..979b224 100644 --- a/docs/reference/theme_fern.html +++ b/docs/reference/theme_fern.html @@ -1,89 +1,64 @@ -A specific theme for trace plots — theme_fern • ferrn - - -
    -
    -
    - +
    +
    +
    -
    +

    A specific theme for trace plots

    -
    +
    +

    Usage

    theme_fern()
    -
    -

    Value

    +
    +

    Value

    a ggplot2 theme for explore_trace_interp()

    -
    - -
    +
    -
    - +
    diff --git a/docs/sitemap.xml b/docs/sitemap.xml index 967ec34..09ca097 100644 --- a/docs/sitemap.xml +++ b/docs/sitemap.xml @@ -28,7 +28,6 @@ https://huizezhang-sherry.github.io/ferrn/reference/ferrn-package.html https://huizezhang-sherry.github.io/ferrn/reference/format_label.html https://huizezhang-sherry.github.io/ferrn/reference/get.html -https://huizezhang-sherry.github.io/ferrn/reference/get_best.html https://huizezhang-sherry.github.io/ferrn/reference/huber.html https://huizezhang-sherry.github.io/ferrn/reference/index.html https://huizezhang-sherry.github.io/ferrn/reference/optim.html diff --git a/man/explore_space_tour.Rd b/man/explore_space_tour.Rd index 971d3b2..6013bd1 100644 --- a/man/explore_space_tour.Rd +++ b/man/explore_space_tour.Rd @@ -65,10 +65,12 @@ prep_space_tour( Plot the grand tour animation of the bases space in high dimension } \examples{ +if (FALSE){ explore_space_tour(dplyr::bind_rows(holes_1d_better, holes_1d_geo), group = method, palette = botanical_palettes$fern[c(1, 6)] ) } +} \seealso{ Other main plot functions: \code{\link{explore_space_start}()}, diff --git a/man/ferrn-package.Rd b/man/ferrn-package.Rd index d5ab74a..7e02c22 100644 --- a/man/ferrn-package.Rd +++ b/man/ferrn-package.Rd @@ -14,6 +14,7 @@ Diagnostic plots for optimisation, with a focus on projection pursuit. These sho Useful links: \itemize{ \item \url{https://github.com/huizezhang-sherry/ferrn/} + \item \url{https://huizezhang-sherry.github.io/ferrn} \item Report bugs at \url{https://github.com/huizezhang-sherry/ferrn/issues} } diff --git a/man/huber.Rd b/man/huber.Rd index dca6dfa..5fb4b0f 100644 --- a/man/huber.Rd +++ b/man/huber.Rd @@ -109,29 +109,46 @@ the default plot specification, e.g. \code{\link[ggplot2:borders]{borders()}}.} \item{index}{a function, the projection pursuit index function, see examples} } \description{ -Create Huber plot with ggplot2 +The Huber plot presents the projection pursuit index values of 2D data in each 1D +projection in polar coordinates, corresponding to each projection direction. +It offers a simpler illustration of more complex projection from +high-dimensional data to lower dimensions in projection pursuit. The +function \code{prep_huber()} calculates each component required for the Huber plot +(see details), which can then be supplied to various geom layers in ggplot2. +} +\details{ +the \code{prep_huber()} function calculates components required for +making the Huber plots. It returns a list including three elements: +\describe{ + \item{the \code{idx_df} data frame: }{the x/y coordinates of the index value, in polar +coordinates. Used for plotting the index value at each projection direction, +with the reference circle.} + \item{the \code{proj_df} data frame: }{the best 1D projection. Used for plotting +the 1D projection in histogram.} + \item{the \code{slope} value: }{the slope to plot in the Huber plot to indicate the +direction of the best 1D projection.} + } } \examples{ -if (require(ash, quietly = TRUE)) { - library(ggplot2) - library(tourr) - data(randu) - randu_std <- as.data.frame(apply(randu, 2, function(x) (x-mean(x))/sd(x))) - randu_std$yz <- sqrt(35)/6*randu_std$y-randu_std$z/6 - randu_df <- randu_std[c(1,4)] - randu_huber <- prep_huber(randu_df, index = norm_bin(nr = nrow(randu_df))) +library(ggplot2) +library(tourr) +library(ash) +data(randu) +randu_std <- as.data.frame(apply(randu, 2, function(x) (x-mean(x))/sd(x))) +randu_std$yz <- sqrt(35)/6*randu_std$y-randu_std$z/6 +randu_df <- randu_std[c(1,4)] +randu_huber <- prep_huber(randu_df, index = norm_bin(nr = nrow(randu_df))) - ggplot() + - geom_huber(data = randu_huber$idx_df, aes(x = x, y = y)) + - geom_point(data = randu_df, aes(x = x, y = yz)) + - geom_abline(slope = randu_huber$slope, intercept = 0) + - theme_huber() + - coord_fixed() +ggplot() + + geom_huber(data = randu_huber$idx_df, aes(x = x, y = y)) + + geom_point(data = randu_df, aes(x = x, y = yz)) + + geom_abline(slope = randu_huber$slope, intercept = 0) + + theme_huber() + + coord_fixed() - ggplot(randu_huber$proj_df, aes(x = x)) + - geom_histogram(breaks = seq(-2.2, 2.4, 0.12)) + - xlab("") + ylab("") + - theme_bw() + - theme(axis.text.y = element_blank()) -} +ggplot(randu_huber$proj_df, aes(x = x)) + + geom_histogram(breaks = seq(-2.2, 2.4, 0.12)) + + xlab("") + ylab("") + + theme_bw() + + theme(axis.text.y = element_blank()) }