Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
How to make a plot with different colors to represent different data values/thresholds?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I need to generate a plot have a couple of elements below: ▪ Small dots when State 5 = green, State 3 = yellow ▪ Big circles when thresholds occur: State 5 = orange, State 3 = red
Appreciate tips/assistance on this.
0 Kommentare
Antworten (1)
D. Plotnick
am 28 Jun. 2018
You can use a nested switch-case statement. Lets say you have data x,y,state1,state2.
switch state1
case 5
switch state2
case 1
markerSize = 3;
color = 'r'
marker = '.'
case 2
""
""
""
end
case 3
""
""
""
end
end
mn = [color,marker]
plot(x,y,mn,'MarkerSize',markerSize);
You should be able to fill in the rest: nested switches are good for this, you will just have to appropriately define you cases for each switch.
3 Kommentare
Diese Frage ist geschlossen.
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!