Plotting different sized vectors
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Emma Walker
am 1 Jun. 2023
Kommentiert: Emma Walker
am 1 Jun. 2023
I am trying to visualize different participant data from an experiment. Participants took different amounts of time to complete the task and so the length of their time vectors is different. In the experiment, participants indicated feedback to us which we took down a timestamp of. Some participants produced 4 timestamps, some produced as much as 60. At the risk of redundancy, I am going to try to explain this thoroughly: I want to visualize this as a horizontal histogram basically where the horizontal axis is the normalized percentage of their total time and where their feedback occured with repect to their total amount of time they took to complete the task. The vertical axis is the participant number. How can I do this when some produced more data points than others?
Example:
P1: 4, 24, 130, 470, 500
P2, 3, 8, 22, 37, 59, 83, 111, 148, 209
Where the numbers are the timestamps i.e. at 4 seconds, P1 indicated feedback.
Ideally, I would like to make two figures, the first where the horizontal is a time axis that has not been normalized and showcases how some participants took longer than others and the second, described above, where the time axis has been normalized and all points are all plotted against the percentage of the whole time.
3 Kommentare
Akzeptierte Antwort
the cyclist
am 1 Jun. 2023
Bearbeitet: the cyclist
am 1 Jun. 2023
Here is one way. If you have many participants, I would generalize this a bit differently (e.g. by storing participant vectors in a cell array, using a loop). But I don't want to go too far down this path before confirming this is generally what you are looking for.
P1 = [4, 24, 130, 470, 500];
P2 = [3, 8, 22, 37, 59, 83, 111, 148, 209];
figure
hold on
plot(P1/max(P1),1,".","MarkerSize",32,"Color","black");
plot(P2/max(P2),2,".","MarkerSize",32,"Color","black");
set(gca,"YLim",[0.5 2.5],"YTick",[1 2])
6 Kommentare
Weitere Antworten (1)
Steven Lord
am 1 Jun. 2023
If you have an idea in your mind of roughly what you want the plot to look like, open the Plots tab of the Toolstrip and click the downward facing triangle on the right side of the Plots section of that tab. Find a thumbnail that looks close to what you're envisioning then search for the documentation for the function whose name is below the thumbnail to learn more about how to use it.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Graphics Performance 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!