How can I color code lines in graphs depending on quality of data?
3 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(2 个)
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.
0 个评论
Bjorn Gustavsson
2012-7-11
编辑:Bjorn Gustavsson
2012-7-11
You might benefit from the following file exchange submissions:
HTH, Bjeorn
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!