How can I color code lines in graphs depending on quality of data?

4 views (last 30 days)
I am wondering how I could color code data in a graph depending on another set of data which represents the quality (in this case SNR) of each data point i.e. having for example different nuances or colors depending on the value of this other set of data. What I am trying to plot are satellite orbits that a gps-antenna receive and I want to color code these orbits in the 3D graph depending on the quality of the signal the antenna picks up.
Thank you very much for any responses

Answers (2)

Conrad
Conrad on 11 Jul 2012
Hi Viktor, you can try something like this:
t = 0:0.001:2*pi;
x = [sin(t);2*sin(t)]'; y = [cos(t);2*cos(t)]'; % Create dummy data.
quality = [1 2]; % Quality of each data set.
colours = [ 1 0 0;... % Colour corresponding to each quality.
0 1 0];
p = plot(x,y); % Plot data.
for i = 1 : length(p)
set(p(i),'color',colours(q(i),:)); % Change colour of plot.
end
I think this can be easily modified for your purposes; you basically map into the collection of colours depending on the quality. You will probably need to add something that maps between SNR and the "quality" array that indicates which colour to use.

Bjorn Gustavsson
Bjorn Gustavsson on 11 Jul 2012
Edited: Bjorn Gustavsson on 11 Jul 2012

Categories

Find more on CubeSat and Satellites 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!