I want to configure a graphic with a differents colors and types of lines, per each line that there is in my graphic.
For example:
mat %matrix
plot3(mat(:,1),mat(:,2),mat(:,3));
How can I change the call to plot3()?

 채택된 답변

the cyclist
the cyclist 2011년 2월 2일

0 개 추천

The broad answer to your question is that you need to use "handle graphics." If you call plot3 with an output argument:
>> h = plot3(...)
that "handle" h gives you access to the properties of the line objects in the plot.
>> get(h)
will list the properties, which you can then adjust with the "set" command.
There is a lot of info in the documentation on how to do this.

댓글 수: 1

Mtlb Usr
Mtlb Usr 2011년 2월 2일
Hi the cyclist,
I understand it. Besides, I usually use to object figure. I thought that plot3 doesn't use the handle.
regards

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

추가 답변 (3개)

Walter Roberson
Walter Roberson 2011년 2월 2일

1 개 추천

You can define the axis ColorOrder property.

댓글 수: 1

Mtlb Usr
Mtlb Usr 2011년 2월 3일
Hi Walter,
Ok, thank you for your answer.

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

Andrew Newell
Andrew Newell 2011년 2월 2일

0 개 추천

If you have a small number of lines to plot, you can just hand-code it with commands like this:
plot3(mat1(:,1),mat1(:,2),mat1(:,3),'b-')
hold on
plot3(mat2(:,1),mat2(:,2),mat2(:,3),'r--')
See doc linespec for your color and line style options.

댓글 수: 1

Mtlb Usr
Mtlb Usr 2011년 2월 2일
Hi Andrew,
It isn't the case. But your answer, I think that it's OK.
regards

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

Mtlb Usr
Mtlb Usr 2011년 2월 3일

0 개 추천

Hi,
One thing I don't understand yet. Why can't I set one style per each vector of plot3?
I've tried it with several combinations and I don't get good nothing.
plot3(v1,cfg1,v2,cfg2,v3,cfg3) plot3(v1,v2,v3,cfg1,cfg2,cfg3)
Where cfg is lineConfiguration='color|style'.
How can I resolve this?
Thanks
Regards

카테고리

도움말 센터 및 File Exchange에서 Line Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by