Overlapping line plots in one graph for numerous cycles
14 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Harsimran Singh
am 20 Apr. 2022
Beantwortet: Cris LaPierre
am 20 Apr. 2022
Hello Guys,
I am trying to create one graph, that contains overlapping line plots. Each line plot is corresponding to one cycle in data. There are total 5 cycles in an example data(attached). I have attached the data with expected graph which was created in excel.
Would like to know how to create a same kind of graph using Matlab.
In actual data I have 20,000 cycles, which means one graph should contains 20,000 overlapping lines.
Attached data is just an example for 5 cycles, but actual data is composed of 20,000 cycles.
Would apprecite if anyone have any suggestion for me to follow or short script/function which I can use to make required graphs
I am using Matlab R2021b, version
Please let me know if my question is not clear.
0 Kommentare
Akzeptierte Antwort
Cris LaPierre
am 20 Apr. 2022
There are likely many different ways to do this. My first instinct is to use findgroups and splitapply.
rawdata = readtable('Newfile.xlsx');
G = findgroups(rawdata.Cycle);
ax = axes;
hold(ax,'on')
myPlot = @(v) plot(ax,v,'-o');
splitapply(myPlot,rawdata.Pressure,G)
hold(ax,'off')
If you know each cycle will have the same number of points, then you could reshape the vector so each column contains a cycle, then just plot that matrix.
d = reshape(rawdata.Pressure,7,[]);
figure
plot(d,'-o')
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!