Why do I get the warning: "Error updating Axes. DataSpace or ColorSpace conversion method failed." ?

X = logspace(-4,1,2e3);
Y = abs(randn(length(X),1))*1e2;
figure
yyaxis left
loglog(X,Y);
ylim([1e-3,1e3])
yyaxis right
loglog(X,Y*1e-5);
ylim([1e-3*1e-5,1e3*1e-5])
When I'm using yyaxis, I want the coordinates on both sides to show different units of the same set of data, but I run into the above warning. Minimum working example is given.

5 Comments

Hi,
I ran the code and it worked fine so could you please let us know which version of MATLAB you are using?
X = logspace(-4,1,2e3);
Y = abs(randn(length(X),1))*1e2;
figure
yyaxis left
loglog(X,Y);
ylim([1e-3,1e3])
yyaxis right
loglog(X,Y*1e-5);
ylim([1e-3*1e-5,1e3*1e-5])
I ran the above code, and it's working fine. I feel the error is due to some other line of your full code.
X = logspace(-4,1,2e3);
Y = abs(randn(length(X),1))*1e2;
figure
yyaxis left
loglog(X,Y);
ylim([1e-3,1e3])
yyaxis right
loglog(X,Y*1e-5);
ylim([1e-3*1e-5,1e3*1e-5])
I also tried on both of the mentioned versions, and it worked fine I think the error could be coming due to some other part of your complete code.
This is the output from running the example in r21b (I'm using the Chinese version), I've just tested it in MATLAB online but I don't see this warning. I don't think it's a problem in my full code.
Well, thanks very much for the replies, my friends! I've just tested a few more cases and I think it might be caused by some kind of conflict between the yyaxis function and the logarithmic coordinate display.

Sign in to comment.

Answers (0)

Asked:

on 20 May 2024

Commented:

on 20 May 2024

Community Treasure Hunt

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

Start Hunting!