Learn R Programming

discretes (version 0.1.0)

plot.discretes: Plot a numeric series

Description

Plot the discrete values in a numeric series within a specified interval.

Usage

# S3 method for discretes
plot(
  x,
  from = -Inf,
  to = Inf,
  ...,
  closeness = 0.01,
  tol = sqrt(.Machine$double.eps)
)

Value

Invisibly returns the input x object after printing a plot in Base R.

Arguments

x

Numeric series (numeric vector or object of class "discretes").

from, to

Numeric values defining the range to plot; single numerics.

...

Additional arguments passed to the underlying plot() function.

closeness

Numeric value indicating how close to the (non-infinite) sinks the points should no longer be plotted. This is because there are an infinite number of points around each sink.

tol

Passed to dsct_keep() when subsetting the series between from and to.

Details

Sinks at finite values are indicated by vertical dotted gray lines. A red tick mark is used to indicate that a finite sink value is part of the series.

When the series extends to infinity in either direction, three arrows (< or >) are drawn to indicate this. When infinity is part of the series, the last arrow is red.

This is a simple plotting scheme with naive handling of infinite discrete values:

  • The closeness parameter does not adjust with the scale of the data, so may require tuning more often by the user.

  • When the series extends to infinity (in either direction), an arbitrary cutoff of 10 units beyond the last finite sink or representative() value (whichever is closer to the infinite sink) is used. This can be manually adjusted by changing the from and to parameters.

Examples

Run this code
plot(integers())
plot(integers(), from = -50, to = 50)
plot(0.5^natural1(), closeness = 1e-3)
plot(dsct_union(0.5^natural1(), 0), closeness = 1e-3)

Run the code above in your browser using DataLab