Title: | Reproducible and Flexible Label Design |
---|---|
Description: | An open-source R package to deploys reproducible and flexible labels using layers. The 'huito' package is part of the 'inkaverse' project for developing different procedures and tools used in plant science and experimental designs. Learn more about the 'inkaverse' project at <https://inkaverse.com/>. |
Authors: | Flavio Lozano-Isla [aut, cre] |
Maintainer: | Flavio Lozano-Isla <[email protected]> |
License: | GPL-3 | file LICENSE |
Version: | 0.2.5 |
Built: | 2025-03-04 04:03:58 UTC |
Source: | https://github.com/flavjack/huito |
Generate bar codes using QR codes
barcode_qr(text, color = "black", alpha = 1, ecl = "H")
barcode_qr(text, color = "black", alpha = 1, ecl = "H")
text |
text to convert to QR bar code |
color |
Bar code color |
alpha |
Intensity of the bar code color |
ecl |
Error correction level (percentage). "L" (7), "M" (15), "Q" (25) and "H" (30). Defaults to "H" |
plot
library(huito) barcode_qr("LIMA-2021-11-03_15_3_4")
library(huito) barcode_qr("LIMA-2021-11-03_15_3_4")
The dataset were obtained using inti package. The data set is a randomize complete block design (RCBD) with three replications.
fieldbook
fieldbook
A data frame with 24 rows and 5 variables:
barcode for each experimental unit
Plot number
Blocks (3): number of replication in the design
Factor with two levels: irrigated and drought
Factor with four levels: choclito, salcedo, pandela, puno
Import fonts from Google fonts
huito_fonts(fonts = NA)
huito_fonts(fonts = NA)
fonts |
fonts names |
For more fonts visit: https://fonts.google.com/
fonts
Import images and include R magick options
image_import(image, opts = NA)
image_import(image, opts = NA)
image |
path or url |
opts |
R magick functions by layers |
image
Insert barcode in label
include_barcode( label, value, size, position = NA, type = "static", color = "auto", units = "cm" )
include_barcode( label, value, size, position = NA, type = "static", color = "auto", units = "cm" )
label |
label output |
value |
column or path |
size |
image size |
position |
position coordinate |
type |
type of entry: dynamic or static |
color |
image color |
units |
units for the label options |
data frame
Insert image in label
include_image( label, value, size, position = NA, type = "static", units = "cm", opts = NA )
include_image( label, value, size, position = NA, type = "static", units = "cm", opts = NA )
label |
label output |
value |
column or path |
size |
image size |
position |
position coordinate |
type |
type of entry: dynamic or static |
units |
units for the label options |
opts |
R magick funtions |
data frame
Insert shape in label
include_shape( label, value = "hexagon", size = 5.08, position = NA, border_color = "black", border_width = 1, background = NA, units = "cm", panel_color = NA, panel_size = NA )
include_shape( label, value = "hexagon", size = 5.08, position = NA, border_color = "black", border_width = 1, background = NA, units = "cm", panel_color = NA, panel_size = NA )
label |
label output (table) |
value |
type of shape (string: "hexagon") |
size |
shape size (numeric: 5.08) |
position |
position coordinate (numeric: NA) |
border_color |
image color (string: "black") |
border_width |
shape line width (numeric: 1) |
background |
background color (string: "red") |
units |
units for shape (string: "cm") |
panel_color |
panel color (string: NA) |
panel_size |
panel size (numeric: NA) |
data frame
library(huito) label <- label_layout(data = NA , size = c(10, 2.5) , background = "yellow" ) %>% include_shape( value = "hexagon" , position = c(1.2, 1.25) , background = "red" , border_width = 1 , size = 2.4 #, panel_size = 2.4*1.157175 ) label %>% label_print("sample") ts <- label$opts
library(huito) label <- label_layout(data = NA , size = c(10, 2.5) , background = "yellow" ) %>% include_shape( value = "hexagon" , position = c(1.2, 1.25) , background = "red" , border_width = 1 , size = 2.4 #, panel_size = 2.4*1.157175 ) label %>% label_print("sample") ts <- label$opts
Insert text in label
include_text( label, value, position = NA, size = 11, font = NA, type = "static", color = NA, angle = 0, opts = NA )
include_text( label, value, position = NA, size = 11, font = NA, type = "static", color = NA, angle = 0, opts = NA )
label |
label output |
value |
column or string |
position |
position coordinate |
size |
text size |
font |
font type |
type |
type of entry: dynamic or static |
color |
image color |
angle |
angle of the text |
opts |
list arguments from draw_label() |
data frame
Generate labels options
label_layout( data = NA, size, border_width = NA, border_color = "black", background = NA, units = "cm" )
label_layout( data = NA, size, border_width = NA, border_color = "black", background = NA, units = "cm" )
data |
data frame to build the labels |
size |
label size (numeric: c(10, 2.5)) |
border_width |
border width (numeric: 0.5) |
border_color |
border color (string: "transparent") |
background |
background color (string: "transparent") |
units |
units for the label options (string: "cm") |
data frame
label <- label_layout(size = c(10, 2.5) , border_color = "red" , border_width = 1 ) %>% label_print()
label <- label_layout(size = c(10, 2.5) , border_color = "red" , border_width = 1 ) %>% label_print()
Generate labels based in a data frame
label_print( label, mode = "sample", filename = "labels", margin = 0.04, paper = c(21, 29.7), units = "cm", viewer = FALSE, smpres = 200, nlabels = NA )
label_print( label, mode = "sample", filename = "labels", margin = 0.04, paper = c(21, 29.7), units = "cm", viewer = FALSE, smpres = 200, nlabels = NA )
label |
Data frame to build the labels or n repeated labels (table/numeric) |
mode |
Label generation (string: "sample/preview", "complete") |
filename |
Labels file name (string: "labels") |
margin |
Labels margins. margin(numeric vector: t = 0, r = 0, b = 0, l = 0) |
paper |
Paper size. Default A4 (numeric vector: 21.0 x 29.7) |
units |
Units for the label options (string: "cm") |
viewer |
Visualization of the label (logial: FALSE) |
smpres |
Sample resolution if viewer = TRUE (numeric: 200) |
nlabels |
Number of labels to generate (numeric: NA) |
library(huito) fb <- fieldbook label <- fb %>% label_layout(size = c(10, 2.5) , border_color = "blue" ) %>% include_image( value = "https://flavjack.github.io/inti/img/inkaverse.png" , size = c(2.4, 2.4) , position = c(1.2, 1.25) ) %>% include_barcode( value = "barcode" , size = c(2.5, 2.5) , position = c(8.2, 1.25) ) %>% include_text(value = "plots" , position = c(9.7, 1.25) , angle = 90 , size = 15 , color = "red" ) %>% include_text(value = "Inkaverse" , position = c(4.6, 2) , size = 30 , color = "brown" ) %>% include_text(value = "condition" , position = c(4.6, 1.2) , size = 13 , color = "orange" ) %>% include_text(value = "genotypes" , position = c(4.6, 0.5) , size = 13 , color = "#009966" ) %>% label_print(mode = "sample")
library(huito) fb <- fieldbook label <- fb %>% label_layout(size = c(10, 2.5) , border_color = "blue" ) %>% include_image( value = "https://flavjack.github.io/inti/img/inkaverse.png" , size = c(2.4, 2.4) , position = c(1.2, 1.25) ) %>% include_barcode( value = "barcode" , size = c(2.5, 2.5) , position = c(8.2, 1.25) ) %>% include_text(value = "plots" , position = c(9.7, 1.25) , angle = 90 , size = 15 , color = "red" ) %>% include_text(value = "Inkaverse" , position = c(4.6, 2) , size = 30 , color = "brown" ) %>% include_text(value = "condition" , position = c(4.6, 1.2) , size = 13 , color = "orange" ) %>% include_text(value = "genotypes" , position = c(4.6, 0.5) , size = 13 , color = "#009966" ) %>% label_print(mode = "sample")
Hexagon geom shape for ggplot2
shape_hexagon( size = 5.08, border_width = NA, background = NA, border_color = "black", units = "cm", panel_color = "green", panel_size = NA )
shape_hexagon( size = 5.08, border_width = NA, background = NA, border_color = "black", units = "cm", panel_color = "green", panel_size = NA )
size |
hexagon size (numeric: 5.08) |
border_width |
line width (numeric: 1) |
background |
background color (string: "transparent") |
border_color |
border color (string: "black") |
units |
units for shape (string: "cm") |
panel_color |
panel color (string: "green") |
panel_size |
panel size (numeric: NA) |
geom
library(huito) shape_hexagon(border_width = 1 , background = "red" #, panel_size = 5.08 )
library(huito) shape_hexagon(border_width = 1 , background = "red" #, panel_size = 5.08 )