# Any experiences for plotting a stationary wavelet transform?

I am experimenting with wavelets for my thesis and am currently working with the stationary WT pywavelets provides. There are very nice plots for CWTs, but does anyone know a technique for producing a plot that gives a good overall understanding of the produced SWT? Right now I am basically just producing a list of details coefficient plots for each level, and not regarding the averages at all.

I hope this question belongs here. Cheers!

EDIT:

I really just iterate through the transform and plot each details coefficient vector. (I'm aware the example uses DWT and not SWT, but it should be analogous)

fig, axes = plt.subplots(3, 5, figsize=[14, 8])

c = pywt.wavedec(data1, 'haar', mode='periodization')

for i in range(0, 5): axes[0, i].plot(c[i],c = "r")

The result then looks like this:

• SWT is easier than DWT in the sense that you can provides plots (2D) similar to that of the CWT. Could you show what you do plot? – Laurent Duval Aug 6 '19 at 14:19
• Thanks. I added the plots I got. – wavelet_guest Aug 6 '19 at 15:04

I don't do Python, I'm an old person sticking to his old Matlab (codes and) habits. However, up to extension/wavelet/border issues, SWT is a discrete equivalent to CWT. And in most versions, the number of samples in approximations or details is the same (which is not the case for the DWT). Hence, you can concatenate 1D rows of details (or approximations) into 2D images, akin to traditional scalograms. The following images and code show the process. I have generated a random piecewise polynomial signal with increasing degrees. Then rows of details, and an image of the rows concatenated. The motivation is to address the impact of vanishing moments on piece-wise polynomials, with border effects. Here are two different realizations.

The Matlab code, that may be reproduced in Python:

dataLength = 512;
data = zeros(dataLength,1);
nChunk = 4;
lChunk = dataLength/nChunk;
for iChunk = 0:nChunk-1
idxChunk = iChunk*lChunk+(1:lChunk)';
polyChunk = rand(iChunk+1,1)-0.5;
dataChunk = polyval(polyChunk,linspace(-0.5,0.5,lChunk));
data(idxChunk) = dataChunk;
end

nLevel = 4;
[swa,swd] = swt(data,nLevel,'db2');

figure(1);clf
subplot(1,3,1)
plot(data,'x');axis tight
for iPlot = 1:nLevel
subplot(nLevel,3,3*(iPlot-1)+2)
plot(swd(iPlot,:));;axis tight
end
subplot(1,3,3)
imagesc(swd)