plot.wd | R Documentation |
This function plots discrete wavelet transform coefficients arising from a wd
object.
## S3 method for class 'wd'
plot(x,xlabvals, xlabchars, ylabchars, first.level = 0,
main = "Wavelet Decomposition Coefficients", scaling = "global",
rhlab = FALSE, sub, NotPlotVal = 0.005, xlab = "Translate",
ylab = "Resolution Level",
aspect = "Identity", ...)
x |
The wd class object you wish to plot |
xlabvals |
A vector containing the "true" x-axis numbers that went with the vector that was transformed to produce the |
xlabchars |
Tickmark labels for the x axis |
ylabchars |
Tickmark labels for the y axis |
first.level |
The first resolution level to begin plotting at. This argument can be quite useful when you want to supress some of the coarser levels in the diagram. |
main |
The main title of the plot. |
scaling |
How you want the coefficients to be scaled. The options are: The two other options are compensated and super which are the same as |
rhlab |
If |
sub |
A subtitle for the plot. |
NotPlotVal |
This argument ensures that if all (scaled) coefficients in a resolution level are below |
xlab |
A title for the x-axis |
ylab |
A title for the y-axis |
aspect |
This argument describes the name (as a character string) of a function to be applied to the coefficients before plotting. By default the argument is " |
... |
fine tuning |
Produces a plot similar to the ones in Donoho and Johnstone, 1994.
A wavelet decomposition of a signal consists of discrete wavelet coefficients at different scales (resolution levels) and locations. This function plots the coefficients as a pyramid (derived from Mallat's pyramid algorithm). See the examples below.
The resolution levels are stacked one above the other: coarse scale coefficients are always towards the top of the plot, fine scale coefficients are always located toward the bottom of the plot. The location of coefficients increases from left to right across the plot in synchrony with the input signal to the wd
object. In other words the position of a coefficient along a line is indicative of the associated wavelet basis function's translate number. The actual coefficients are plotted using S-Plus's segments()
function. This plots each coefficient as a vertical line with positive coefficients being plotted above an imaginary centre line and negative coefficients being plotted below.
The resolution levels are labelled on the left-hand side axis, and if rhlab==T
the maximum values of the absolute values of the coefficients, for the particular level, are plotted on the right-hand axis.
The coefficients in the plot may be scaled in 4 ways. If you are interested in comparing coefficients in different levels then the default scaling option scaling=="global"
is what you need. This works by finding the coefficient with the largest absolute value amongst all coeffients to be plotted and then scales all the other coefficients by the largest so that all coefficients lie in the range -1/2 to 1/2. The scaled coefficients are then plotted. If you are not interested in comparing relative resolution levels and want to see all that goes on within a particular scale then you should use the scaling option scaling=="by.level"
which picks out the largest coefficient (in absolute value) from each level and scales each level separately. The "compensated
" and super options are like the "global
" option except that finer levels are scaled up (as discussed in the arguments list above): this can be useful when plotting non-decimated wavelet transform coefficients as it emphasizes the higher frequencies.
If rhlab==T
then the scaling factors applied to each scale level are returned. Otherwise NULL is returned.
Version 3.5.3 Copyright Guy Nason 1994
A plot of the coefficients contained within the wd
object is produced.
G P Nason
wd
#
# Generate some test data
#
test.data <- example.1()$y
## Not run: ts.plot(test.data)
#
# Decompose test.data and plot the wavelet coefficients
#
wds <- wd(test.data)
## Not run: plot(wds)
#
# Now do the time-ordered non-decimated wavelet transform of the same thing
#
## Not run: wdS <- wd(test.data, type="station")
## Not run: plot(wdS)
#
# Next examples
# ------------
# The chirp signal is also another good examples to use.
#
# Generate some test data
#
test.chirp <- simchirp()$y
## Not run: ts.plot(test.chirp, main="Simulated chirp signal")
#
# Now let's do the time-ordered non-decimated wavelet transform.
# For a change let's use Daubechies least-asymmetric phase wavelet with 8
# vanishing moments (a totally arbitrary choice, please don't read
# anything into it).
#
chirpwdS <- wd(test.chirp, filter.number=8, family="DaubLeAsymm", type="station")
## Not run: plot(chirpwdS, main="TOND WT of Chirp signal")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.