Plotting a graph with more than one dataset
Mostra commenti meno recenti
Hi,
I am attempting to write a piece of code in MATLAB to plot a graph with thousands of datasets. I am trying to plot a point graph for epicentral distance difference against phase delay for earthquakes. The only problem is I have thousands of events and each event has tens of different correlations. My first thought was manually writing (x1, y1, x2, y2, ...) but not all of the events are the same length as some data is rejected and some just have more correlations. Any suggestions on an easy method or if it is even possible would be greatly appreciated.
Thanks
4 Commenti
MarKf
il 6 Mar 2023
Sorry, I'm unsure that I understand the issue.
plot(x1, y1), hold on, plot(x2, y2), plot(x3, y3), ... etc, would work, as long as there are all the correspending yn to all xn, they (x1, x2, x3 etc) can also be different lenghts (only x1 and y1 need to be the same and so on). (In)dependent variables can also be all the same (x1 all the same phase), if you want to group them like that.
If the issue is about the big data, matlab can handle a lot, but there are also tools that can handle more (e.g. here)
Star Strider
il 6 Mar 2023
If the fies are all to be present in system memory at the same time, it might be easiest to read them into a cell array, perhaps using readtable to import them, if the data are compatible with it.
Computer memory could be an issue, however. The datastore function (and related functions) could be helpful.
With respect to processing and analysing the data, it would be helpful to have more information about what you want to do with them. If you simply want to perform regressions or some other type of analysis on each file, and save the derived parameters and a set of data identifying the source, that would be relatively straightforward to do, and might not cause system memory issues.
Allen
il 7 Mar 2023
Are you trying to create a new figure for each event (with or without each of the different correlations), or are you trying to add thousands of datasets to a single figure? Note that the latter may not be possible due to memory limitations and the former may be more practical to create/save/close separate figures for each event versus opening a large number of figures (again memory limitations may be a concern).
Mathieu NOE
il 7 Mar 2023
hi
I would suggest you share some "typical" data files and the code you have so far
Risposte (1)
Swaraj
il 4 Apr 2023
0 voti
Best way I can suggest is to convert your data as cell arrays and use “plot” function to plot them.
Documentation for “plot” function.
You can use “hold on” and “hold off” to make sure the datasets are plotted on the same graph.
Categorie
Scopri di più su Creating, Deleting, and Querying Graphics Objects in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!