Patch - how to choose colors

1 回表示 (過去 30 日間)
Yoav Romach
Yoav Romach 2014 年 3 月 25 日
編集済み: Yoav Romach 2014 年 3 月 26 日
Hey,
I'm having trouble getting a hold on Patch. I have this code:
xFit = logspace(4,8,1000);
yPredict = predint(fitresult,xFit,0.683,'functional','off');
x=[xFit;xFit];
y=[yPredict(:,1)';yPredict(:,2)'];
patch(x,y,1,'FaceColor','r')
I want it to create a filled area that is transparent red, but I can't even get it to be red... it's always black. I went over the documentation and didn't manage to do it myself... any help?
  2 件のコメント
Yoav Romach
Yoav Romach 2014 年 3 月 25 日
Tried that as well.
I think my main problem is that my x and y are not what they are supposed to be... You can take a look at my original question if that helps, but basically yPredict is a 1000:2 matrix, in which each column is a vector and I want the area in between them to be filled.
Yoav Romach
Yoav Romach 2014 年 3 月 26 日
Ok, problem was basically the ; inside the vector definitions, should be:
x=[xFit xFit];
y=[yPredict(:,1)' yPredict(:,2)'];
Although in the end I didn't use them as I switched to the "area" function instead of patch, much better.

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

採用された回答

Yoav Romach
Yoav Romach 2014 年 3 月 26 日
編集済み: Yoav Romach 2014 年 3 月 26 日
Ok, problem was basically the ; inside the vector definitions, should be:
x=[xFit xFit];
y=[yPredict(:,1)' yPredict(:,2)'];
Although in the end I didn't use them as I switched to the "area" function instead of patch, much better.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangePolygons についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by