How can I create this 2D waterfall plot?
88 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
The data is from a CSV file with one time column and 32 columns of data.
The curves show the Amplitude vs. Time behavior of the sensors while the sensor locations (in meters) are placed on the Y-axis.
I assume this is a waterfall plot, but I can't reproduce it. How can I make a graph like this one?
Réponse acceptée
Steven Lord
le 11 Avr 2019
That's not a waterfall plot, at least not by my understanding. To me a waterfall plot looks like the picture shown on the waterfall function documentation page.
What you've shown looks more like the "Plot Multiple Lines" or "Create Line Plot From Matrix" examples on the documentation page for the plot function, though your multiple lines look like their Y data is different enough that the lines don't overlap. In that I agree with Adam Danz, that plot is probably the right tool for this job.
If neither of those look like what you want, open the Plots tab on the Toolstrip and click the downward pointing triangle in the PLOTS section. Scan through the thumbnails to see if one looks like what you want. Once you've found such a thumbnail ask for help or doc on the function name written under the picture, or open up the Catalog (the button in the lower corner of the PLOTS dropdown) and locate the thumbnail / function of the same name to see the documentation page for that function.
0 commentaires
Plus de réponses (3)
srt10
le 29 Août 2019
That plot does look like a waterfall plot. You can obtain a plot like that by trying
figure()
waterfall(time,position,data)
Here time is your time vector and position is a 1x32 vector that corresponds to each column of your data. Make sure the matrix "data" is of the correct dimensions (length(time) x 32). You may rotate the resulting waterfall plot to get what is shown in the figure. Good luck!
0 commentaires
Vladimir
le 21 Sep 2020
Try stackedplot built-in plotting routine
1 commentaire
Adam Danz
le 21 Sep 2020
The use of stackedplot is not a solution in this case because each line in the demo image extends into the territory of the next line along the y-axis. With stackedplot, each line would have its own ylim which would prevent overlaping.
Qiang
le 2 Août 2024
I guess these y data are in the roughtly same range and the demo figure is a stacked line by y offsets. This kind of figure is often used in comparison of the results of the same characterizaion technique on samples, like XRD, FT-IR, etc. For them, people dont pay much attention to the absolute intensities of each line, but the relative comparison between each. I sometimes use a trick in matlab that a constant value is incrementally added to the line so that each line can be offset in y-axis. I also wanted to know if there is a quick operation in matlab to realize that when plotting a matrix or table.
1 commentaire
Rik
le 2 Août 2024
If all your data is in a single matrix, you can use the + operator with implicit expansion to add a vector. Do you need an example implementation?
Voir également
Catégories
En savoir plus sur Line Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!