Plotting segment data: superimposed plots

The dplot function is used to superimpose, on the same time axis, a given parameter track for any set of segments. The time-series plots can be also be linearly time-normalised.

dplot takes one obligatory argument which is a trackdata object output from the track function (which is itself applied to a segment list, see ).

As a simple example of the use dplot, the following instructions superimpose the F2 tracks of all [i:] segments in the database on the same display. The first two instructions are used to obtain the segment list and the corresponding formant data:

segs.i <- emu.query("demo", "*", "Phonetic=i:")
fvals <- track(segs.i, "fm")

The plot shows superimposed F2 traces for [i:] vowels with the separate vowels aligned at t=0, the vowel onset. The separate plots can be aligned at any time point using the offset argument, which can vary between 0 (segment onset) and 1 (segment offset). Thus to align them at the segment midpoint (i.e. such that t=0 is at the segment midpoint for each segment):

dplot(fvals, offset=0.5)

The normalise argument can be used for linear time normalistion. If normalise is T, then the vowels are linearly stretched and compressed such that their onset and offset times occur at t=0, and t=1 respectively:

dplot(fvals, normalise=T)

The average argument can be used to average the plots, either from the original traces, or from linearly time normalised traces. The following:

dplot(fvals, average=T)

averages the traces aligned at the segment onset (the default being offset=0): that is, averaging is done of the values at successive data points (at 5ms, 10ms, 15ms...for a track sampling rate of 200 Hz).

The following instruction also averages but with the traces lined up at the segment midpoint (i.e. averages are computed at t=0 ms, 5 ms, -5ms, 10ms, -10ms\ldots where t=0 is the segment midpoint):

dplot(fvals, average=T, offset=0.5)

Averaging can also be done from the linearly time-normalised trace by including normalise=T (note that the offset argument is redundant when normalise=T):

dplot(fvals, average=T, normalise=T)

Figure 11.5, “Four examples of dplot with no options (top left), offset=0.5 (top right), normalise=T (bottom left) and normalise=T, average=T (bottom right)” shows four uses of dplot with various options.

Figure 11.5. Four examples of dplot with no options (top left), offset=0.5 (top right), normalise=T (bottom left) and normalise=T, average=T (bottom right)

Four examples of dplot with no options (top left), offset=0.5 (top right), normalise=T (bottom left) and normalise=T, average=T (bottom right)

In all the examples so far, dplot has been used on one-dimensional data (i.e. a single parameter, F2). But all the examples given so far can be applied to multidimensional signal file data returned from track. In this example, data from the first two formants (of the earlier segment list) are plotted, and aligned at the temporal midpoint (no time normalisation):

newdat <- emu.track(segs.i, "fm")
dplot(newdat[,1:2], offset=0.5, main="First two formant frequencies for [i:] vowels")

dplot can be used with a parallel label file to compare signal files from different types of segments. This is done by supplying the label file as a second argument. In this example, F2 of all [o:], [i:], and [A] vowels are compared on F2. The traces are aligned at the temporal midpoint:

segs <- emu.query("demo", "*", "Phonetic=i:|o:|A")
dat <- emu.track(segs, "fm")
dplot(dat[,2], label(segs), offset=0.5)

All of the other examples given earlier, using averaging, time normalisation, and multiple parameter plots can be used when a parallel label file is supplied. For example, the following instructions plot average, time-normalised plots of F1 and F2 for the same three vowels:

dat <- emu.track(segs, "fm")
dplot(dat[,1:2], labs, average=T, normalise=T, ylab="frequency (Hz)",
        main="time=normalised F1 and F2 for three vowels")