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 Commenti

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.
What part of the image shows this: " some unexpected 'scatter's at the two endpoints" ? What end points? What scatter?
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"?

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Graphics in Centro assistenza e File Exchange

Richiesto:

il 11 Gen 2023

Commentato:

il 23 Feb 2023

Community Treasure Hunt

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

Start Hunting!

Translated by