Unexpected elements appear when using yyaxis plot
1 view (last 30 days)
Show older comments
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','-')
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1259410/image.png)
3 Comments
Adam Danz
on 11 Jan 2023
What part of the image shows this: " some unexpected 'scatter's at the two endpoints" ? What end points? What scatter?
Divyanshu
on 23 Feb 2023
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"?
Answers (0)
See Also
Categories
Find more on Scatter Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!