Help with change curve line color from MATLAB

3 次查看(过去 30 天)
I use following code:
CurveObjectToday = TheChartObject.Chart.SeriesCollection.NewSeries;
CurveObjectToday.Name = 'T'; % curve legend
% Select data for the curve
XRange = DataSheet.Range([Contract_Col, num2str(StartRow)...
,':',Contract_Col, num2str(EndRow)]);
YRange = DataSheet.Range([M2MBasisToday_Col, num2str(StartRow)...
,':',M2MBasisToday_Col, num2str(EndRow)]);
CurveObjectToday.XValues = XRange;
CurveObjectToday.Values = YRange;
CurveObjectToday.Type = 4;
CurveObjectToday.Format.Line.ForeColor.RGB = 3; % red
The curve was plotted, but the color was not changed to the 'red' as I expected. ANy suggestion? Thanks a lot.
  2 个评论
Andrew Newell
Andrew Newell 2011-3-18
Where did you get TheChartObject from? I can't find any documentation on it.
Derek Jing
Derek Jing 2011-3-18
Define the chart by yourself, I just skipped it here...

请先登录,再进行评论。

回答(1 个)

Jan
Jan 2011-3-18
Please try this:
CurveObjectToday.Format.Line.ForeColor.RGB = RGB(255, 0, 0); % red
  2 个评论
Derek Jing
Derek Jing 2011-3-18
Got error:
??? Error: Type mismatch, argument 0
Derek Jing
Derek Jing 2011-3-18
I also tried:
CurveObjectToday.Format.Line.ForeColor.RGB = 'RGB(255, 0, 0)'; % red
same error.
Then I tried
CurveObjectToday.Format.Line.ForeColor.RGB(255, 0, 0); % red
got error: ??? Index exceeds matrix dimensions.

请先登录,再进行评论。

标签

Community Treasure Hunt

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

Start Hunting!

Translated by