Learn R Programming

ggtikz (version 0.1.5)

ggtikzTransform: Transform TikZ coordinates according to scale transformations

Description

ggtikzTransform extracts coordinates definitions in an annotation's TikZ code and transforms them with the transformer functions stored in the underlying plot's x or y scales, respectively.

Usage

ggtikzTransform(ggtikzCanvas, ggtikzAnnotation)

Value

A link{ggtikzAnnotation} object, with transformations applied to the coordinates in the TikZ code.

Arguments

ggtikzCanvas

A link{ggtikzCanvas} object.

ggtikzAnnotation

A link{ggtikzAnnotaton} object.

Details

This function does not have to called directly. It is automatically called when annotations are added to a canvas, if transform = TRUE in the ggtikzAnnotation construction call.

Coordinates components with physical lengths are not changed. For a plot with a linear x scale and a log10-transformed y scale,

  • the TikZ coordinate (10,10) becomes (10,1),

  • the TikZ coordinate (10cm,10) becomes (10cm,1),

  • the TikZ coordinate (10,10cm) becomes (10,10cm)

  • the TikZ coordinate (0,0) will raise an error.