# Matlab warning when using log

20 views (last 30 days)
Niklas Kurz on 15 Sep 2021
Commented: Adam Danz on 16 Sep 2021
I have quiete a long script basically just consiting of comments for plotting pairs of points and customizing the resulting plot. However anytime I want to change axis to logscale I receive the following waring:
Warning: Error occurred while executing the listener callback for event
WindowMouseMotion defined for class matlab.ui.Figure:
Error using matlab.graphics.axis.dataspace.CartesianDataSpace/TransformPoints
DataSpace or ColorSpace transform method failed.
Error in matlab.graphics.internal.transformDataToWorld (line 29)
vertexData = double(hDataSpace.TransformPoints(belowMatrix,iter));
Error in matlab.graphics.chart.internal.convertDataSpaceCoordsToViewerCoords (line
44)
vertexData = matlab.graphics.internal.transformDataToWorld(hDataSpace, belowMatrix,
dataspaceData);
Error in matlab.graphics.function.FunctionLine/calcXYZData
Error in matlab.graphics.function.FunctionLine/getXYZData
Error in matlab.graphics.function.FunctionLine/doGetNearestPoint
Error in matlab.graphics.interaction.uiaxes.DataTipsBase
Error in matlab.graphics.interaction.actions.Linger/motionCallback
Error in matlab.graphics.interaction.actions.Linger
This is the code I used. Plain plotting
f = [5 10 20 40 80 160 320 640]*10^3;
U = [4.77 4.23 3.11 1.85 0.98 0.50 0.25 0.13]./5;
plot(f,U,'x','MarkerSize',14,'LineWidth',2.5)
hold on
grid minor
xlabel('Frequenz f in Hz','FontSize',16,'Interpreter','latex')
ylabel('Quotient $\frac{U_E}{U_A}$','FontSize',16,'Interpreter','latex')
axis([0 7*10^5 0 4.77./5])
set(gca,'FontSize',14)
syms x;
R = 10^3; C = 10*10^(-9);
fG = 1.588e+04;
F = 1./sqrt((x/fG).^2+1);
fplot(F,'LineWidth',1)
set(gca,'YScale','log','XScale','log') %this is the reason for all of it.
legend('Messwerte','Verlauf')
I tried using loglog or any other function to manipulate axis, but it occures steadily.
Adam Danz on 16 Sep 2021
Sorry, I meant Matlab R2021a. It didn't cause an error in 21a. However, I didn't catch that the error is caused when zooming. When I zoom in 21a, I do get the warning you shared. Looks like WR set it straight.

Walter Roberson on 16 Sep 2021
axis([0 7*10^5 0 4.77./5])
set(gca,'YScale','log','XScale','log') %this is the reason for all of it.
Do not use an axis limit of 0 with log scale: it would require an infinite plot.
Niklas Kurz on 16 Sep 2021
Edited: Niklas Kurz on 16 Sep 2021
that's it, actually pretty obvious:

### Categories

Find more on Combine Multiple 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!