assign colarmap to multiple lines' lengths

11 ビュー (過去 30 日間)
Zhenjia
Zhenjia 2013 年 6 月 25 日
I have a graph with weights associated to the edges. I plot the edges as lines and I would like to assign colors in a continuous colormap to each edge. Does any one know how to do it? Thanks.

回答 (2 件)

Kelly Kearney
Kelly Kearney 2013 年 6 月 25 日
Do you mean something like this?
x = 1:10;
y = rand(1,10);
w = 1:10; % weights
patch([x NaN],[y NaN],[c NaN], 'edgecolor', 'interp', 'facecolor', 'none')

Zhenjia
Zhenjia 2013 年 6 月 26 日
Yes, "patch" seems the right command for my problem. However, I have two lines crossing with each other. For "Patch", I have to divide these two lines into four lines. Is there any way to keep two lines? I want to keep the color the same for each line, even though it is crossed by other line. Thanks.
  1 件のコメント
Walter Roberson
Walter Roberson 2013 年 6 月 26 日
patch would not require that you divide the lines if you do not want the crossing to influence the coloring.

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

カテゴリ

Help Center および File ExchangeColor and Styling についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by