Title: | Procedurally Generated Fish Drawings Via Javascript |
---|---|
Description: | Procedurally generated fish drawings via ggplot2 based on fishdraw JavaScript library <https://github.com/LingDong-/fishdraw>. |
Authors: | Liuyong Ding |
Maintainer: | Liuyong Ding <[email protected]> |
License: | Artistic-2.0 |
Version: | 0.1.0 |
Built: | 2024-11-23 03:33:08 UTC |
Source: | https://github.com/otoliths/rfishdraw |
This package is designed for procedurally generated fish drawings via ggplot2 based on fishdraw JavaScript library <https://github.com/LingDong-/fishdraw>.
Package: | rfishdraw |
Type: | Package |
Title: | Procedurally Generated Fish Drawings Via Javascript |
Version: | 0.1.0 |
Date: | 2021-08-25 |
Author: | Liuyong Ding |
Maintainer: | Liuyong Ding <[email protected]> |
Description: | Procedurally generated fish drawings via ggplot2 based on fishdraw JavaScript library <https://github.com/LingDong-/fishdraw>. |
Depends: | R (>= 3.5.0) |
Imports: | jsonlite, ggplot2 |
Suggests: | rmarkdown, knitr, prettydoc, patchwork, devtools |
VignetteBuilder: | knitr |
License: | Artistic-2.0 |
URL: | https://github.com/Otoliths/rfishdraw |
BugReports: | https://github.com/Otoliths/rfishdraw/issues |
Encoding: | UTF-8 |
LazyData: | true |
RoxygenNote: | 7.1.1 |
Repository: | https://otoliths.r-universe.dev |
RemoteUrl: | https://github.com/otoliths/rfishdraw |
RemoteRef: | HEAD |
RemoteSha: | 2023942e5939b4e4ebadae28695579a5366a482c |
Index of help topics:
custom_params Create and implement a custom JS library. fish_draw Procedurally generated fish drawings via ggplot2 get_polylines Get outputs polylines (supported format svg, json, csv, etc.) rfishdraw-package Procedurally Generated Fish Drawings Via Javascript
Maintainer: Liuyong Ding <[email protected]>
Procedurally generated fish drawings via ggplot2 based on fishdraw JavaScript library https://github.com/LingDong-/fishdraw.
custom_params( path = "./fishdraw.js", save = getwd(), body_curve_type = 0, body_curve_amount = 0.85, body_length = 420, body_height = 90, scale_type = 1, scale_scale = 1, pattern_type = 3, pattern_scale = 1, dorsal_texture_type = 1, dorsal_type = 0, dorsal_length = 100, dorsal_start = 8, dorsal_end = 27, wing_texture_type = 0, wing_type = 0, wing_start = 6, wing_end = 6, wing_y = 0.7, wing_length = 130, wing_width = 10, pelvic_start = 9, pelvic_end = 14, pelvic_length = 85, pelvic_type = 0, pelvic_texture_type = 0, anal_start = 19, anal_end = 29, anal_length = 50, anal_type = 0, anal_texture_type = 0, tail_type = 0, tail_length = 75, finlet_type = 0, neck_type = 0, nose_height = 0, mouth_size = 8, head_length = 30, head_texture_amount = 60, has_moustache = 1, moustache_length = 10, has_beard = 0, has_teeth = 1, teeth_length = 8, teeth_space = 3.5, beard_length = 30, eye_type = 0, eye_size = 10, jaw_size = 1, jaw_open = 1 )
custom_params( path = "./fishdraw.js", save = getwd(), body_curve_type = 0, body_curve_amount = 0.85, body_length = 420, body_height = 90, scale_type = 1, scale_scale = 1, pattern_type = 3, pattern_scale = 1, dorsal_texture_type = 1, dorsal_type = 0, dorsal_length = 100, dorsal_start = 8, dorsal_end = 27, wing_texture_type = 0, wing_type = 0, wing_start = 6, wing_end = 6, wing_y = 0.7, wing_length = 130, wing_width = 10, pelvic_start = 9, pelvic_end = 14, pelvic_length = 85, pelvic_type = 0, pelvic_texture_type = 0, anal_start = 19, anal_end = 29, anal_length = 50, anal_type = 0, anal_texture_type = 0, tail_type = 0, tail_length = 75, finlet_type = 0, neck_type = 0, nose_height = 0, mouth_size = 8, head_length = 30, head_texture_amount = 60, has_moustache = 1, moustache_length = 10, has_beard = 0, has_teeth = 1, teeth_length = 8, teeth_space = 3.5, beard_length = 30, eye_type = 0, eye_size = 10, jaw_size = 1, jaw_open = 1 )
path |
Path for fishdraw.js |
save |
save |
body_curve_type |
|
body_curve_amount |
|
body_length |
|
body_height |
|
scale_type |
|
scale_scale |
|
pattern_type |
|
pattern_scale |
|
dorsal_texture_type |
|
dorsal_type |
|
dorsal_length |
|
dorsal_start |
|
dorsal_end |
|
wing_texture_type |
|
wing_type |
|
wing_start |
|
wing_end |
|
wing_y |
|
wing_length |
|
wing_width |
|
pelvic_start |
|
pelvic_end |
|
pelvic_length |
|
pelvic_type |
|
pelvic_texture_type |
|
anal_start |
|
anal_end |
|
anal_length |
|
anal_type |
|
anal_texture_type |
|
tail_type |
|
tail_length |
|
finlet_type |
|
neck_type |
|
nose_height |
|
mouth_size |
|
head_length |
|
head_texture_amount |
|
has_moustache |
|
moustache_length |
|
has_beard |
|
has_teeth |
|
teeth_length |
|
teeth_space |
|
beard_length |
|
eye_type |
|
eye_size |
|
jaw_size |
|
jaw_open |
|
Custom JS library.
Note that some fish species might not be representable with this system, and passing "bad" params might produce weird results or crash the program.
Liuyong Ding [email protected]
## Not run: # create and implement a custom JS library custom_params(path = "./fishdraw.js",save = getwd()) ## End(Not run)
## Not run: # create and implement a custom JS library custom_params(path = "./fishdraw.js",save = getwd()) ## End(Not run)
Procedurally generated fish drawings via ggplot2
fish_draw(data = NULL, x = x, y = y, group = group, ...)
fish_draw(data = NULL, x = x, y = y, group = group, ...)
data |
Path for *.json via |
x |
see |
y |
see |
group |
see |
... |
see |
## Not run: # fish drawings via plot file <- system.file("extdata",package = "rfishdraw") dat <- readRDS(paste0(file,"/","output_json.rds")) for (i in seq(length(dat))) { dat[[i]] <- cbind(dat[[i]],i) } plot(NA, xlim = c(0,520),ylim = c(-320,0),axes = F,xlab = " ",ylab = " ") for(i in seq(length(dat))) { lines(x = dat[[i]][,1],y = -dat[[i]][,2], lwd=2, col = "blue") } # fish drawings via ggplot2 fish_draw() ## End(Not run)
## Not run: # fish drawings via plot file <- system.file("extdata",package = "rfishdraw") dat <- readRDS(paste0(file,"/","output_json.rds")) for (i in seq(length(dat))) { dat[[i]] <- cbind(dat[[i]],i) } plot(NA, xlim = c(0,520),ylim = c(-320,0),axes = F,xlab = " ",ylab = " ") for(i in seq(length(dat))) { lines(x = dat[[i]][,1],y = -dat[[i]][,2], lwd=2, col = "blue") } # fish drawings via ggplot2 fish_draw() ## End(Not run)
Get outputs polylines (supported format svg, json, csv, etc.)
get_polylines( path = "./fishdraw.js", name = NULL, format = "svg", output = "output.svg", draw_type = "random" )
get_polylines( path = "./fishdraw.js", name = NULL, format = "svg", output = "output.svg", draw_type = "random" )
path |
Path for fishdraw.js or customs.js via |
name |
The name string is used as the name of the fish (printed in the drawing). If unspecified, a random pseudo-Latin name will be auto generated. |
format |
Format options: svg (regular svg), smil (animated svg), csv (each polyline on a comma-separated line) and json. |
output |
Outputs polylines (supported format svg, json, csv, etc.) |
draw_type |
Draw_type options: random(by design fishdraw.js program is for randomly generated fishes),custom(by create and implement a custom customs.js for your favorite fish). |
## Not run: # Get outputs polylines in svg get_polylines(path = "inst/fishdraw.js", format = "svg", output = "output.svg", draw_type = "random") # Get outputs polylines in json get_polylines(path = "inst/fishdraw.js", format = "json", output = "output.json", draw_type = "random") # Get outputs polylines in smil get_polylines(path = "inst/fishdraw.js", format = "smil", output = "output.svg", draw_type = "random") # browse animated svg browseURL("inst/animated.svg") ## End(Not run)
## Not run: # Get outputs polylines in svg get_polylines(path = "inst/fishdraw.js", format = "svg", output = "output.svg", draw_type = "random") # Get outputs polylines in json get_polylines(path = "inst/fishdraw.js", format = "json", output = "output.json", draw_type = "random") # Get outputs polylines in smil get_polylines(path = "inst/fishdraw.js", format = "smil", output = "output.svg", draw_type = "random") # browse animated svg browseURL("inst/animated.svg") ## End(Not run)