{"id":16275605,"url":"https://github.com/andrie/attractor","last_synced_at":"2025-04-08T16:41:36.386Z","repository":{"id":139000375,"uuid":"183760292","full_name":"andrie/attractor","owner":"andrie","description":"Generate and plot a strange attractor using R","archived":false,"fork":false,"pushed_at":"2019-05-13T14:26:57.000Z","size":22153,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-14T13:17:01.654Z","etag":null,"topics":["r","r-package","rstats"],"latest_commit_sha":null,"homepage":"https://andrie.github.io/attractor","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andrie.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-27T10:43:43.000Z","updated_at":"2019-07-31T13:28:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"7dca7f25-4dff-4860-a44e-e10c550e6925","html_url":"https://github.com/andrie/attractor","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrie%2Fattractor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrie%2Fattractor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrie%2Fattractor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrie%2Fattractor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andrie","download_url":"https://codeload.github.com/andrie/attractor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247886273,"owners_count":21012812,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["r","r-package","rstats"],"created_at":"2024-10-10T18:35:32.001Z","updated_at":"2025-04-08T16:41:36.359Z","avatar_url":"https://github.com/andrie.png","language":"C++","readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.height=\"400px\"\n)\nknitr::opts_knit$set(global.par = TRUE)\npar(mar = rep(0, 4), mai = rep(0, 4))\n```\n\n# attractor \u003cimg src=\"man/figures/attractor-logo.png\" align=\"right\" width=\"120\" /\u003e\n\n\n\u003c!-- badges: start --\u003e\n\u003c!-- badges: end --\u003e\n\nThe goal of `attractor` is to generate and plot strange attractors.\n\nUsing this package is fast, because:\n\n1. The attractor algorithm uses `Rcpp` for speed.\n1. The resulting attractor is discretized (binned) into a much smaller matrix, making plotting very fast.\n\n\n\n## Installation\n\nYou can install the development version from [GitHub](https://github.com/) with:\n\n``` r\n# install.packages(\"devtools\")\ndevtools::install_github(\"andrie/attractor\")\n```\n\n## Example\n\nCreate a strange attractor with 10 million points, then discretize to a matrix with dimensions `400 x 400`:\n\n\n```{r}\nlibrary(magrittr)\nlibrary(attractor)\n\na \u003c- seed_sprott_7e(21031)\n\ndat \u003c- \n  a %\u003e% \n  attractor_sprott_7e(1e6, dims = c(400, 400))\nstr(dat)\n```\n\n\n## Plotting a strange attractor\n\n```{r}\npar(mar = rep(0, 4), mai = rep(0, 4))\ndat %\u003e% \n  recolour() %\u003e% \n  plot()\n```\n\n\n## Recolour the plot\n\nUse `recolour()` to change the colours. You can use any of the colours defined by the `scales::col_numeric()` function. From the help of `?scales::col_numeric()`:\n\nThe palette argument can be any of the following:\n\n1. A character vector of RGB or named colours. Examples: `palette()`, `c(\"#000000\", \"#0000FF\", \"#FFFFFF\")`, `topo.colors(10)`\n\n2. The name of an `RColorBrewer` palette, e.g. `\"BuPu\"` or `\"Greens\"`.\n\n3. A function that receives a single value between 0 and 1 and returns a colour. Examples: `colorRamp(c(\"#000000\", \"#FFFFFF\"), interpolate=\"spline\")`.\n\n\nUse the `Oranges` palette:\n\n```{r}\ndat %\u003e% \n  recolour(\"Oranges\") %\u003e%\n  plot()\n```\n\nTo change the background colour, specify a `zero_colour`:\n\n```{r}\ndat %\u003e% \n  recolour(\"Oranges\", zero_colour = \"#FFFAF6\") %\u003e%\n  plot()\n```\n\nYou can also invert the palette\n\n```{r}\ndat %\u003e% \n  recolour(\"Oranges\", zero_colour = \"grey20\", invert = TRUE) %\u003e%\n  plot()\n```\n\nTry the `Spectral` palette:\n\n\n```{r}\ndat %\u003e% \n  recolour(\"Spectral\", zero_colour = \"#9E0142\") %\u003e%\n  plot()\n```\n\nWith inversion:\n\n```{r}\ndat %\u003e% \n  recolour(\"Spectral\", invert = TRUE, zero_colour = \"#5E4FA2\") %\u003e%\n  plot()\n```\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrie%2Fattractor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandrie%2Fattractor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrie%2Fattractor/lists"}