h = stackedplot(rand(6,3));
There does not seem to be an easy way to set the XTick or XTickLabel of a StackedLineChart object (such as what's created by stackedplot):
data = rand(6,3); h = stackedplot(1:6,data);
% try a couple of things, neither of which work try set(h,'XTick',1:6,'XTickLabel',{'A' 'S' 'T' 'AAA' 'BBB' 'ZZZ'}) catch ME disp(['Cannot use set(_,''XTick''): ' ME.message]); try xticks(h,1:6) catch ME disp(['Cannot use xticks(_): ' ME.message]); end end
Cannot use set(_,'XTick'): Unrecognized property XTick for class StackedLineChart. Cannot use xticks(_): Using xticks with stackedplot is not supported.
However, you can do it if you use tiledlayout (or subplot):
figure(); tiledlayout(3,1,'TileSpacing','tight'); for i = [1 2 3] ax = nexttile; plot(data(:,i)); box off if i < 3 set(get(ax,'XAxis'),'Visible','off'); end ylabel(ax,sprintf('Column %d',i), ... 'Rotation',0, ... 'HorizontalAlignment','right'); end % now ax is the bottom axes set(ax, ... 'XTick',1:6, ... 'XTickLabel',{'A','S','T','AAA','BBB','ZZZ'}, ... 'XTickLabelRotation',90);
Matlabsolutions.com provides guaranteed satisfaction with a
commitment to complete the work within time. Combined with our meticulous work ethics and extensive domain
experience, We are the ideal partner for all your homework/assignment needs. We pledge to provide 24*7 support
to dissolve all your academic doubts. We are composed of 300+ esteemed Matlab and other experts who have been
empanelled after extensive research and quality check.
Matlabsolutions.com provides undivided attention to each Matlab
assignment order with a methodical approach to solution. Our network span is not restricted to US, UK and Australia rather extends to countries like Singapore, Canada and UAE. Our Matlab assignment help services
include Image Processing Assignments, Electrical Engineering Assignments, Matlab homework help, Matlab Research Paper help, Matlab Simulink help. Get your work
done at the best price in industry.