Plot Grid points with different colours
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Evangelos Rompogiannakis
am 18 Nov. 2020
Beantwortet: Evangelos Rompogiannakis
am 18 Nov. 2020
Hello Everyone
I have two variables
x = linspace(0,25,26)
y = linspace(0,25,26)
and i want to create a graph with x,y axis
where the points where the x<y are going to be coloured in red. Also the points where x > 16 i want the points to be shown in black colour.
Could someone plz guide me on what method to use? I have made a code that creates a grid but i dont know hot to celect these points abd give them the appropriate colour.
Thank you
1 Kommentar
Adam Danz
am 18 Nov. 2020
Duplicate: https://www.mathworks.com/matlabcentral/answers/651643-2-d-plot
Hint: Here's an analogy
x = 1:20;
y = ones(1,20);
idx = x < 10;
plot(x(idx),y(idx), 'r-o')
hold on
plot(x(~idx),y(~idx), 'b-o')
Akzeptierte Antwort
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!