nos.xyplot {NostalgiR}R Documentation

nos.xyplot text-based scatter plot.

Description

Plots a text-based scatter plot, with the option of having a regression line, or a linear interpolation of the points.

Usage

nos.xyplot(x = 1:length(y), y, xlab = NULL, ylab = NULL, ratio = 0.25,
  width = round(options()$width * 0.8), height = round(ratio * width),
  pch = c("o", "~"), type = "p")

Arguments

x

A numeric vector containing the x-values to be plotted. NA and NaN are allowed, but are removed for the plot. Infinities will cause an error.

y

A numeric vector containing the y-values to be plotted. NA and NaN are allowed, but are removed for the plot. Infinities will cause an error.

xlab

Label of the x-axis of the plot.

ylab

Label of the y-axis of the plot.

ratio

Coefficient that controls the aspect ratio of the plot.

width

Width of the plot in points.

height

Height of the plot in points.

pch

A two dimensional vector of single-character symbols. The first symbol is for the x and y coordinate points, and the second symbol is for the interpolation or regression line.

type

One of the values in the set c('l','p','r','lp','pr'). Type 'l' plots a linear interpolation, type 'p' plots the x and y coordinates as points, type 'r' plots a linear regression line, type 'lp' plots x and y coordinates along with a linear interpolation, and type 'pr' plots x and y coordinates along with a linear regression line.

Note

Due to rounding to a relatively crude grid results can only be approximate. The equally spaced axis ticks, for example, may be non-equally spaced in the plot. Further, due to the crude grid also there might be several points per character. The function uses the same plotting symbol no matter how many points coincide on one character position.

Author(s)

Hien D. Nguyen

See Also

plot and txtplot.

Examples

## Plot 10 correlated points
x <- 10*runif(10)
y <- x + rnorm(10)
nos.xyplot(x,y,type='p',xlab='x',ylab='y')

## Plot 10 correlated points with a regression line
x <- 10*runif(10)
y <- x + rnorm(10)
nos.xyplot(x,y,type='pr',xlab='x',ylab='y')

## Plot 10 correlated points with a linear interpolation
x <- 10*runif(10)
y <- x + rnorm(10)
nos.xyplot(x,y,type='lp',xlab='x',ylab='y')

[Package NostalgiR version 1.0.2 Index]