Matplotlib 3D Waterfall Plot with Colored Heights

Viewed 13152

I'm trying to visualise a dataset in 3D which consists of a time series (along y) of x-z data, using Python and Matplotlib.

I'd like to create a plot like the one below (which was made in Python: http://austringer.net/wp/index.php/2011/05/20/plotting-a-dolphin-biosonar-click-train/), but where the colour varies with Z - i.e. so the intensity is shown by a colormap as well as the peak height, for clarity.

enter image description here

An example showing the colormap in Z is (apparently made using MATLAB): enter image description here

This effect can be created using the waterfall plot option in MATLAB, but I understand there is no direct equivalent of this in Python.

I have also tried using the plot_surface option in Python (below), which works ok, but I'd like to 'force' the lines running over the surface to only be in the x direction (i.e. making it look more like a stacked time series than a surface). Is this possible? enter image description here

Any help or advice greatly welcomed. Thanks.

2 Answers

with a pandas dataframe with the x axis as the first column and each spectra as another column

offset=0
for c in s.columns[1:]:
    plt.plot(s.wavelength,s[c]+offset)
    offset+=.25
    plt.xlim([1325,1375])

enter image description here

Related