Connect datapoints in Plot

21 visualizzazioni (ultimi 30 giorni)
Pascal Schindler
Pascal Schindler il 18 Ott 2021
Commentato: Pascal Schindler il 19 Ott 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

Risposta accettata

Dave B
Dave B il 19 Ott 2021
Modificato: Dave B il 19 Ott 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');

Più risposte (0)

Prodotti


Release

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by