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

3 ビュー (過去 30 日間)
Viktor
Viktor 2012 年 7 月 11 日
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

回答 (2 件)

Conrad
Conrad 2012 年 7 月 11 日
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 2012 年 7 月 11 日
編集済み: Bjorn Gustavsson 2012 年 7 月 11 日

カテゴリ

Help Center および File ExchangeCubeSat and Satellites についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by