text_plot: Make a plot of text labels

View source: R/colour.R

text_plotR Documentation

Make a plot of text labels

Description

Like text except it creates a new plot with limits chosen to make all labels visible.

Usage

text_plot(object, ...)

Arguments

x, y

numeric vectors, same length

data

a data frame with at least two columns

formula

a formula specifying a response and predictor variable

labels

character vector, same length as x

srt

rotation angle as in text.

adj

text justification as in text.

Details

The main job of text.plot is finding the right plot limits so that all labels are visible. It does this by computing the bounding box of each label (taking into account text rotation and justification) and solving a system of inequalities which ensure that each label fits entirely into the plot window.

Author(s)

Tom Minka

Examples

data(state)
x <- data.frame(state.x77)
text_plot(x$Frost, x$HS.Grad, rownames(x))

# same thing, using text.plot.formula
text_plot(HS.Grad ~ Frost, x)

# notice how the limits change
text_plot(HS.Grad ~ Frost, x, srt=45)
text_plot(HS.Grad ~ Frost, x, srt=90)

paulemms/datamining documentation built on March 1, 2023, 4:01 p.m.