Error is code given in documentation: The coordinate system or ruler class does not support log axis scale.

3 次查看(过去 30 天)
Hello,
I am new in MatLab and I need some help to fix a bit of code. I have tried a few suggestions but still does not work.
The issue is that I try to convert axis to logarithmic:
The parameters are obtained using [cfs, f, coi] = cwt(signal,'amor',seconds(1/Fs));
Thank you in advance
function varargout = helperPlotScalogram(f,cfs,coi)
nargoutchk(0,1);
ax = newplot;
surf(ax,1:3000,f,abs(cfs),'EdgeColor','none')
ax.YScale = 'log';
%set(gca=ax, 'YScale', 'log')
clim([0.01 1])
colorbar
grid on
ax.YLim = [min(f) max(f)];
ax.XLim = [1 size(cfs,2)];
view(0,90);
xlabel('Time');
ylabel('Cycles/Sample')
if nargin == 3
hl = line(ax,1:3000,coi,ones(3000,1));
hl.Color = 'k';
hl.LineWidth = 2;
end
if nargout > 0
varargout{1} = ax;
end
end

回答(1 个)

Navya Singam
Navya Singam 2022-11-23
Hi,
The command newplot creates a new plot and the axis can be converted into logaithmic scale by using the command ax.YScale = 'log'
ax = newplot;
ax.YScale = 'log';
(or)
gca returns the current axes and axes scales can be set using the set command.
set(gca, 'YScale', 'log')
You can refer to the rulers section in https://www.mathworks.com/help/matlab/ref/matlab.graphics.axis.axes-properties.html to understand how to change the axes scales.

类别

Help CenterFile Exchange 中查找有关 Graphics Performance 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by