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:
Here is the code (link: https://uk.mathworks.com/help/wavelet/ug/boundary-effects-and-the-cone-of-influence.html, go down to appendix)
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
0 个评论
回答(1 个)
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Graphics Performance 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!