Connect datapoints in Plot
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Pascal Schindler
am 18 Okt. 2021
Kommentiert: Pascal Schindler
am 19 Okt. 2021
Hi there
so i have a Dataset which I'm plotting. Now i wanna try to connect the single datapoints with a line so it's more of a graph than just single points.
I found the function line(); in another post.
Is there a mistake in my code or can I not use it this way ?
Or are there any other better fitting solutiouns to this ?
So far this is my code:
daten = readtable("datasetexperiment1.csv");
scatter(datasetexperiment1,"Times","vms");
line("Times","vms",'LineStyle','-');
Thanks ahead
Pascal
0 Kommentare
Akzeptierte Antwort
Dave B
am 19 Okt. 2021
Bearbeitet: Dave B
am 19 Okt. 2021
Unfortunately, not all plotting functions accept table variables in MATLAB yet (scatter was one of the first of the 'traditional' plotting functions that we added table support to in R2021b).
So for the time being, you can use plot (I strongly recommend that over line), but you'll need to specify the values rather than the table variables. Your code would look like:
daten = readtable("datasetexperiment1.csv");
scatter(daten,"Times","vms");
hold on
plot(daten.Times, daten.vms);
Note that plot can also include markers, so you could just do:
daten = readtable("datasetexperiment1.csv");
plot(daten.Times, daten.vms,'-o');
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Line 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!