tikzscat: Simple 'TikZ' scatter plot

View source: R/latex_tables.R

tikzscatR Documentation

Simple TikZ scatter plot

Description

Create a simple 2D TikZ scatter plot, useful for plotting PCA data.

Usage

tikzscat(data, obs_lvls, marks, tscale, axes_color = "gray")

Arguments

data

Data to plot, m x 2 numeric matrix, where m is the number of observations or points to plot.

obs_lvls

Levels or groups associated with each observation.

marks

Character vector determining how to draw the points in TikZ, for example: c("mark=square*,mark options={color=red},mark size=0.8pt", "mark=diamond*,mark options={color=black},mark size=1pt", "mark=triangle*,mark options={color=green},mark size=1pt").

tscale

The scale property of the TikZ figure.

axes_color

Axes color (must be a LaTeX/TikZ color).

Details

This function creates a simple TikZ 2D scatter plot within a tikzpicture environment. The points are plotted on a normalized figure with x and y axes bounded between [-1, 1]. To render adequately, the final LaTeX document should load the plotmarks TikZ library.

Value

A string containing the TikZ figure code for plotting the specified data.

Examples

tikzscat(rbind(c(1.5, 2), c(0.5, 1)), factor(c(1,2)),
         c("mark=square*,mark options={color=red},mark size=0.8pt",
           "mark=diamond*,mark options={color=black},mark size=1pt"),
         6)


FakenMC/micompr documentation built on Jan. 31, 2024, 5:09 a.m.