x axis labels not properly working
Show older comments
I am having trouble getting the x axis tick marks and labels to display when I attempt to plot. Here is my code I am using. Everything else seems to work fine. The labels on the bottom x axis should be -0.08, -0.04, 0, 0.04, and 0.08.
%% Plotting section
figure;
%plot total hydrometeor mixing ratio differences
h1=plot((qr_diff(1,:)+qs_diff(1,:)+qg_diff(1,:)+qh_diff(1,:)).*1000,[1:50],'k-','LineWidth',4);
hold on;
%add a text label
text(-0.06,42,'d) total q','FontSize',42,'FontWeight','bold');
%axes properties
xlim([-0.08 0.08]);
xticks([-0.8:0.4:0.8]);
xticklabels({'-0.8';'-0.4';'0';'0.4';'0.8'});
xlabel('g kg^{-1}','FontSize',22,'FontWeight','bold');
aa = get(gca,'XTickLabel'); set(gca,'XTickLabel',aa,'FontSize',22,'FontWeight','bold');
ylim([0 50]);
yticks([0:10:50]);
yticklabels({'0';'10';'20';'30';'40';'50'});
ylabel('Model Level','FontSize',22,'FontWeight','bold');
bb = get(gca,'YTickLabel'); set(gca,'YTickLabel',bb,'FontSize',22,'FontWeight','bold');
set(gca,'TickDir','out');
set(gcf,'units','pixels','outerposition',[1 1 900 900],'windowstyle','normal')
% set inner position (plot box); force it square
set(gca,'units','normalized','position',[0.1300 0.1100 0.7750 0.8150],'plotboxaspectratio',[1 1 1])
saveas(gcf,[times(t,:),'_stincre_totq_vprof_',exps{nex},'.png'])
close

Accepted Answer
More Answers (0)
Categories
Find more on Axis Labels 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!