Procedurally generated fish drawings via ggplot2 based on fishdraw Javascript JavaScript library. Note: You need to install nodejs before using the rfishdraw package.
Installing nodejs under from windows nodejs.
brew search node
brew install node@14
brew link node@14
node --version
sudo apt-get install nodejs
Install development versions from GitHub with:
library(devtools)
install_github("Otoliths/rfishdraw")
library("rfishdraw")
get_polylines(path = "inst/fishdraw.js",
format = "smil",
output = "animated.svg",
draw_type = "random")
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_draw()
require(ggplot2)
p1 <- fish_draw() +
theme_void()
library(patchwork)
p1+p1+p1+p1+p1+p1+plot_layout(ncol = 2)
Contributions to this package are welcome. The preferred method of contribution is through a GitHub pull request. Feel also free to contact us by creating an issue.