Package 'mycolorsTB'

Title: Color Palettes for Mycobacterium Tuberculosis Data Visualization
Description: Colour palettes and helper functions for visualising Mycobacterium tuberculosis genomic and epidemiological data with 'ggplot2' and 'ggtree'. The package provides predefined palettes, scale functions, tree/cladogram helpers, and convenient preview tools to ensure consistent branding in pathogen-omics visualisations. The palettes were developed as part of the 'mycolorsTB' project <https://github.com/PathoGenOmics-Lab/mycolorsTB>.
Authors: Paula Ruiz-Rodriguez [aut, cre]
Maintainer: Paula Ruiz-Rodriguez <[email protected]>
License: GPL-3
Version: 0.1.1
Built: 2026-05-12 06:56:23 UTC
Source: https://github.com/cran/mycolorsTB

Help Index


ClassicTB Color Palette

Description

An unnamed vector of 14 colors derived from the classicTB theme.

Usage

classicTB

Format

A character vector of 14 hex color codes.

Source

Color palette designed by the PathoGenOmics Lab.


Mycolors Color Palette

Description

A named vector of 14 colors designed for visualizing Mycobacterium tuberculosis lineages.

Usage

mycolors

Format

A character vector of 14 hex color codes, named with lineage identifiers.

Source

Color palette designed by the PathoGenOmics Lab.


PathoGenOmics Color Palette

Description

A palette of 8 colors from the PathoGenOmics Lab theme.

Usage

pathogenomics

Format

A character vector of 8 hex color codes.

Source

Color palette designed by the PathoGenOmics Lab.


Plot a Phylogenetic Cladogram with TB Lineage Colors

Description

Visualizes a phylogenetic tree as a cladogram, coloring tips with the mycolors palette.

Usage

plot_tb_cladogram(newick_text)

Arguments

newick_text

A character string with the tree in Newick format.

Value

A ggplot object representing the phylogenetic cladogram.

Examples

tree_text <- "(L8,((L1,(L7,(L4,(L2,L3)))),(L5,((A2,(A3,A4)),(A1,(L10,(L6,L9)))))));"
plot_tb_cladogram(tree_text)

Plot a Phylogenetic Tree with TB Lineage Colors

Description

Reads a tree in Newick format and plots it using ggtree, coloring tips with the mycolors palette.

Usage

plot_tb_tree(newick_text)

Arguments

newick_text

A character string with the tree in Newick format.

Value

A ggplot object representing the phylogenetic tree.

Examples

tree_text <- "(L8,((L1,(L7,(L4,(L2,L3)))),(L5,((A2,(A3,A4)),(A1,(L10,(L6,L9)))))));"
plot_tb_tree(tree_text)

Scale Color for ggplot2 Using classicTB Palette

Description

Applies the classicTB palette to the color aesthetic in a ggplot.

Usage

scale_color_classicTB()

Value

A ggplot2 scale object.


Scale Color for ggplot2 Using mycolors Palette

Description

Applies the mycolors palette to the color aesthetic in a ggplot.

Usage

scale_color_mycolors()

Value

A ggplot2 scale object.


Scale Fill for ggplot2 Using classicTB Palette

Description

Applies the classicTB palette to the fill aesthetic in a ggplot.

Usage

scale_fill_classicTB()

Value

A ggplot2 scale object.


Scale Fill for ggplot2 Using mycolors Palette

Description

Applies the mycolors palette to the fill aesthetic in a ggplot.

Usage

scale_fill_mycolors()

Value

A ggplot2 scale object.


Generate n colors from a mycolorsTB palette

Description

Uses color interpolation to create a custom number of colors from a given palette.

Usage

tb_palette(n, palette_name = "classicTB")

Arguments

n

The number of colors to generate.

palette_name

The name of the palette to use ("mycolors", "classicTB", or "pathogenomics").

Value

A character vector of n hex color codes.

Examples

# Generate 20 colors from the 'classicTB' palette
my_custom_colors <- tb_palette(20, "classicTB")
plot(1:20, 1:20, col = my_custom_colors, pch = 19, cex = 3)

Display a color palette

Description

Generates a ggplot visualization of a specified package palette.

Usage

view_palette(palette_name = "mycolors")

Arguments

palette_name

The name of the palette to display ("mycolors", "classicTB", or "pathogenomics").

Value

A ggplot object showing the colors of the chosen palette.

Examples

view_palette("mycolors")
view_palette("classicTB")