How to set LineStyle for matrix plotting?

I have a matrix that I would like to plot, but I would like each column to be plotted using a different LineStyle. To do so I set the Axes LineStyleOrder property to the desired value, then I set the NextPlot property to 'replacechildren', but for some reason all columns get the same (the first value in LineStyleOrder) LineStyle. I works well with ColorOrder, but not with LineStyles.
Anyone knows why, or how I should solve my problem?
Thanks in advance!

 채택된 답변

Michael Haderlein
Michael Haderlein 2015년 5월 5일
편집: Michael Haderlein 2015년 5월 5일

0 개 추천

It's not very intuitive, but that's the point (from here):
Axes increments the line style only after using all of the colors in the ColorOrder property .
Plus, you need to set hold all:
set(axes,'LineStyleOrder',{'-','--',':','-.'}') %create axes with respective LineStyleOrder
hold all %Prevent clearing LineStyleOrder
plot(1:3,bsxfun(@plus,rand(3,15),0:14)) %use it
(similar information is given in the help of the axes properties, here)

댓글 수: 3

So there's basically no way to use a custom set of ColorSet and StyleOrder at the same time? I mean:
set( hAx , 'ColorOrder' , [ 0 0 1 ; 0 1 0 ; 1 0 0 ] );
set( hAx , 'LineStyleOrder' , { '-' , ':' , '-.' } );
So that the first column of the data will be blue AND a solid line, the second green AND dotted...
Michael Haderlein
Michael Haderlein 2015년 5월 5일
편집: Michael Haderlein 2015년 5월 5일
I don't see a possibility to do it this way. I have once made a function which will set the line styles to all children of given axes (useful for b/w printings). But to do it in advance? I wouldn't know how right now.
András
András 2015년 5월 5일
Thanks.

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

추가 답변 (0개)

카테고리

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

제품

태그

질문:

2015년 5월 5일

댓글:

2015년 5월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by