Wrong coloring of legend in semilogx plot
조회 수: 3 (최근 30일)
이전 댓글 표시
I realized in both 2013a and 2013b that there seems to be a bug in the coloring in the semilogx function. Colors displayed in the legend are not even present in the plot itself and sometimes the order seems to be wrong. In any case it's not possible to say which color refers to which data. I tried solving this problem for some days now and I'm pretty desperate about it. It's the same result whether I call the function from a .m-file or directly from the command window. Any work around? That's the code I use
figure(3)
semilogx(f20,real(var20(:,8)), f40,real(var40(:,8)), f60, real(var60(:,8)),f80, real(var80(:,8)), f100, real(var100(:,8)))
legend('20','40','60', '80', '100')
The attached picture shows the disaster.
Thanks for your help!
댓글 수: 2
Chad Greene
2014년 10월 30일
Can you give us your f20, etc data, or make some up?
Does the same problem happen if you use plot instead of semilogx?
채택된 답변
Matt Tearle
2014년 10월 30일
I just tried an example in R2013b and it worked fine, but then I messed with it a bit and happened to get something very similar to what you're seeing. So try looking at the dimensions of your x variables, f60 in particular.
whos f*
When I used a matrix for one of the x variables, it got messed up. Perhaps f60 is a matrix instead of a vector?
If that's not the issue, is there any way you can share your variables with us? (Or, at very least, size/type/etc)
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Legend에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!