Home > Blockchain >  How to set ylim of only left axis object?
How to set ylim of only left axis object?

Time:11-11

I use to yyaxis to create chart with two y-axes. Now I want to change ONLY the YLim of left axis to be zero.

I tried to use:

ax = gca;
ax.YAxis(1).YLim(1) = 0;

But I got an error message:

Assignment not supported because the result of method 'YLim' is a temporary value.

How to resolve this problem?

CodePudding user response:

From the documentation:

yyaxis left activates the side of the current axes associated with the left y-axis. Subsequent graphics commands target the left side.

So, use

yyaxis left
ax = gca;
ax.YLim(1) = 0;
  • Related