Unexpected elements appear when using yyaxis plot
이전 댓글 표시
When I am using yyaxis to plot different lines on both axis, something went wrong. After activating the right axis, I firstly add a line and everything went on just fine. But as I was trying to add more lines, there appeared some unexpected 'scatter's at the two endpoints. I have no idea what happened. Is there a limit of the number of lines that can be plotted on one axis?
yyaxis left
x_draw=(-3+1.5/14):3/14:(0-1.5/14);
% pl=plot(x_draw,count,'linewidth',5,'color',[65,105,225]./255);
a=area(x_draw,count,'linewidth',5,'facecolor',[65,105,225]./255,'edgecolor',[65,105,225]./255);
a.FaceAlpha=0.2;
hold on
x_star4=log10(0.02);
x_star5=log10(0.04);
x_star6=log10(0.08);
plot([x_star4 x_star4],[0 pro_4*15000],'Color',[178 34 34]./255,'linewidth',3,'linestyle','-')
plot([x_star5 x_star5],[0 pro_5*15000],'Color',[178 34 34]./255,'linewidth',3,'linestyle','-')
plot([x_star6 x_star6],[0 pro_6*15000],'Color',[178 34 34]./255,'linewidth',3,'linestyle','-')
plot([-x_star4 0],[pro_4*15000 pro_4*15000],'Color',[178 34 34]./255,'linewidth',3,'linestyle','-')
plot([-x_star5 0],[pro_5*15000 pro_5*15000],'Color',[178 34 34]./255,'linewidth',3,'linestyle','-')
plot([-x_star6 0],[pro_6*15000 pro_6*15000],'Color',[178 34 34]./255,'linewidth',3,'linestyle','-')

댓글 수: 3
Jonas
2023년 1월 11일
without having all your variables available, it looks like the probblem are the last three lines and the fact, that your x axis is logarithmic.. there you want to draw a horizontal line from e.g. the negative value -x_star4 (which is a value between -10 and -1) up to the value 0. you can not draw in the area <=0 in a logarithmic plot. what did you want to achieve there?
for further help it would be nice to have all your variables available, you can attach dem here using a mat file e.g.
Adam Danz
2023년 1월 11일
What part of the image shows this: " some unexpected 'scatter's at the two endpoints" ? What end points? What scatter?
Divyanshu
2023년 2월 23일
Can you provide more information about the variables used in the code and also indicate which part of plot indicate that "scatter's at the two endpoints"?
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Graphics에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!