Connect datapoints in Plot
19 views (last 30 days)
Show older comments
Pascal Schindler
on 18 Oct 2021
Commented: Pascal Schindler
on 19 Oct 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 Comments
Accepted Answer
Dave B
on 19 Oct 2021
Edited: Dave B
on 19 Oct 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');
More Answers (0)
See Also
Categories
Find more on Axis Labels in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!