If I e.g. have the following two vectors:
data = [1 2 3 -4 -5 6 -7 8 9 -10]
pos = [1 2 3 4 5 6 7 8 9 10]
How can I do
plot(abs(data),pos)
set(gca,'xscale','log');
where only the negative data is circled? Is that even possible without stepping through each data point?

 채택된 답변

Rick Rosson
Rick Rosson 2015년 3월 13일
편집: Rick Rosson 2015년 3월 13일

0 개 추천

isNeg = (data < 0);
plot(abs(data),pos)
hold on
plot(abs(data(isNeg)),pos(isNeg),'o')
set(gca,'xscale','log');

추가 답변 (1개)

Toke Søltoft
Toke Søltoft 2015년 3월 13일

0 개 추천

thanks so much. Works like a charm.

카테고리

도움말 센터File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

제품

태그

질문:

2015년 3월 13일

답변:

2015년 3월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by