How can I plot something like this ?

Hello everybody,Capture.PNG
I have a hard time finding the right approach for plotting my data like in the photo. Each branch corresponds to a direction and the intersection is the origin. Does anyone know a classical way to do this?

回答 (1 件)

darova
darova 2019 年 7 月 22 日

0 投票

You have to think how to draw many lines with different colors. I'd use jet() colormap
Untitled.png
Simple example
cm = jet(256); % create 256 colors of jet() colormap
h(1) = plot([0 1],[0 1],'COlor',cm(220,:)); % draw red line
hold on
h(2) = plot([1 2],[1 2],'Color',cm(190,:)); % draw orange line
h(3) = plot([2 3],[2 3],'Color',cm(160,:)); % draw yellow line
hold off
set(h,'LineWidth',5);

2 件のコメント

othmane jerhaoui
othmane jerhaoui 2019 年 7 月 23 日
Hello,
Thank your for your answer. I actually did some research and I ended up doing this:
x = linspace(-8,0,n); y = x;
% p = plot(x,y,'r', 'LineWidth',5);
%
% % modified jet-colormap
% cd = [uint8(jet(n)*255) uint8(V)].';
%
% drawnow
% set(p.Edge, 'ColorBinding','interpolated', 'ColorData',cd)
%
Now what I didn't figure out is how to display the colorbar to see the values. Do you know how to do it?
Adam
Adam 2019 年 7 月 23 日
doc colorbar
Always search the help first for the most obvious key words. In this case not only a keyword, but an actual function with exactly the name you would expect!

サインインしてコメントする。

カテゴリ

質問済み:

2019 年 7 月 22 日

コメント済み:

2019 年 7 月 23 日

Community Treasure Hunt

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

Start Hunting!

Translated by