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

5 vues (au cours des 30 derniers jours)
Viktor
Viktor le 11 Juil 2012
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

Réponses (2)

Conrad
Conrad le 11 Juil 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 le 11 Juil 2012
Modifié(e) : Bjorn Gustavsson le 11 Juil 2012

Catégories

En savoir plus sur CubeSat and Satellites 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