Effacer les filtres
Effacer les filtres

How do i plot N amount of rows into a point plot?

2 vues (au cours des 30 derniers jours)
MBM
MBM le 16 Jan 2022
Modifié(e) : MBM le 16 Jan 2022
Guys, how do you plot multiple rows into a point plot?
Here's what i've done so far:
figure(2)
F = grades(1,:);
E = 1:width(grades);
scatter(E,F)
xlabel('Assignment','FontSize',15);ylabel('Grade','FontSize',15);
yticklabels({'-3','00','02','4','7','10','12'});
title ('Grades per assignment','FontSize',20);
In this code i only plot row 1 but what if i need to plot N Rows? I need to write a code where the input argument is an NxM Matrix.

Réponse acceptée

Max Heimann
Max Heimann le 16 Jan 2022
Whats the content of your variable "grades"?
You can plot multiple lines one after the other with the hold command. (A,B,C,D,E,F are your data vectors)
figure('Name','Example Plot')
scatter(A,B)
hold on
scatter(C,D)
scatter(E,F)
...
You could simply loop over your matrix and plot each line like this.
  5 commentaires
Max Heimann
Max Heimann le 16 Jan 2022
I did account for that by adding
(1 - 2 * rand) * 0.1
To the data on each cycle. This should be a random number between -.1 and .1. Did this not work?
MBM
MBM le 16 Jan 2022
It worked! Thanks!!! :D

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Scatter Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by