Plot different color data range

조회 수: 10 (최근 30일)
Hazards
Hazards 2020년 1월 8일
답변: Sindar 2020년 1월 9일
Hello everyone,
I want to plot a simple time series over time, but with 2 different colors.
For a specific range of data on my x-axis (time values), I want to change the color.
How can I do that?
Thanks in advance!
  댓글 수: 3
Hazards
Hazards 2020년 1월 8일
Of course
darova
darova 2020년 1월 8일
Did it work?

댓글을 달려면 로그인하십시오.

답변 (1개)

Sindar
Sindar 2020년 1월 9일
x = -10:.01:10;
y = sin(x);
idx = x<=0;
plot(x(idx),y(idx),'r*',x(~idx),y(~idx),'b*')

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by