Skip to content

Make PDF with labels for experiments from Julia DataFrame using Typst

License

Notifications You must be signed in to change notification settings

emanuel-kopp/Labelyst.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

77 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Labelyst

Build Status Stable

Create labels containing QR-codes and human-readable codes for your experiments!

The package exports one function only, labelyst(), which takes a Julia DataFrame and some additional parameters as inputs and translates it into a Typst file which is then, if desired, compiled into a PDF. To work with Labelyst.jl you need Typst installed on your computer, learn about installation here.

Basic usage

The package is registered at the General registry and can be installed with add Labelyst. The input DataFrame needs to have one column named ID and one column named label. The ID column will be used to make the QR-code, it is advisable not to use too long IDs (e.g. for 500 samples, just use s001-s500 or something similar). The column label will be used for the human-readable part of the label: here one can add information about treatments, blocks or similar. Depending on the input parameters provided, one of the defined methods of labelyst() will be called to flexibly produce labels for different situations (i.e. pot labels, adhesive labels, ...)

Examples

Create labels to print on adhesive paper

# Create example data
testdf = DataFrame(
    ID=["p001", "p002", "p003", "p004", "p005", "p006", "p007", "p008",
        "p009", "p010", "p011", "p012", "p013", "p014", "p015", "p016"],
    label=["label-1", "label-2", "label-3", "label-4",
            "label-5", "label-6", "label-7", "label-8",
            "label-9", "label-10", "label-11", "label-12",
            "label-13", "label-14", "label-15", "label-16"])
# Create labels (in this example: 16 labels arranged as 8 rows and 2 columns on a DIN A4 paper)
labelyst(testdf,"example_1", "a4", [8, 2]; font_size = "20pt")

Create labels for pot experiments

# Here: one page of size 90mm x 17mm (i.e. a typical size for a pot label) per label
labelyst(testdf,"example_2", ["90mm", "17mm"]; font_size = "10pt")

Multi-line labels

Long label texts will print on multiple lines, and line-breaks can be forced with a double backslash (\\).

testdf = DataFrame(
    ID=["p001", "p002"],
    label=["Treatment: red \\ Block: 2 \\ Contact: S. Omeone",
    "Treatment: blue \\ Block: 1 \\ Contact: S. Omeone"])
# Create labels
labelyst(testdf,"example_3", "a4", [8, 2])

About

Make PDF with labels for experiments from Julia DataFrame using Typst

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages