updated to using sample values for plotting
adapted to new sample format