Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ysoh286/xstitch
R package for generating cross-stitch charts
https://github.com/ysoh286/xstitch
cross-stitch cross-stitching r
Last synced: about 1 month ago
JSON representation
R package for generating cross-stitch charts
- Host: GitHub
- URL: https://github.com/ysoh286/xstitch
- Owner: ysoh286
- Created: 2017-12-21T22:29:27.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2021-02-06T11:04:43.000Z (almost 4 years ago)
- Last Synced: 2024-08-06T03:03:54.811Z (5 months ago)
- Topics: cross-stitch, cross-stitching, r
- Language: R
- Homepage:
- Size: 64.5 KB
- Stars: 7
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## xstitch: A package for creating cross-stitch charts
### WHAT
A package that creates a cross-stitch chart for you. All you have to do is supply an image!
Partly inspired by privefl's [pixelart](https://github.com/privefl/pixelart) shiny app.### TO GET
To install:
```{r}
devtools::install_github('ysoh286/xstitch')
```### TO USE
Simply provide a path to an image.
```{r}
library(xstitch)
chart(imgpath, height = 100)
```You can also specify the number of squares you'd like to use by height through the `height` argument (by default this is 100).
Note that the smaller the height number, the less number of colours and more 'pixelated' it becomes. Cannot take in SVG format.Don't want to use 30+ colours of string?
You can restrict the number of colours used by using the `num` argument.---
### DEV NOTES / Memory joggers
Re-read Wickham's R packages book online for a memory jog.
Quickstart:
Be in directory + run `devtools::load_all()` and run the functions with change to test.
To run tests:
- Write tests in the `testthat` folder in `tests.R`. Add test images in the same folder
- Run the tests by running `devtools::tests()`**Ideas**
- Speed improvements: `text.default` when plotting / rendering chart is really slow - found by profiling using `Rprof()` & `summaryRprof()`. Ideally find a way to NOT do this (a case of using random colours / patterns in the squares?)
To run a quick profile test
```
Rprof() ## run
chart(img)
Rprof(NULL)
summaryRprof()
```- Methods of finding the closest colours (currently using Euclidean distance / kmeans) for improvement
- Get it onto CRAN? (but will need a memory jog on building R packages, since it's been 3++ years since this was developed)
- Accomodate for SVG images (to research on)