It was not so easy to replace the plotyy code with the following:
The idea is simple: plot bars, hold on and then plot scatter.
The problems were axes limits and labels not alignting properly.
The idea is simple: plot bars, hold on and then plot scatter.
The problems were axes limits and labels not alignting properly.
% Create figure
close all
figure1 = cfigure(30,10);
% Create axes
axes1 = axes('Parent',figure1, 'YTick',[0 1 2 3]);%,...
xlim(axes1,[min(dvec_d) max(dvec_d)]);
% Uncomment the following line to preserve the Y-limits of the axes
ylim(axes1,[0 3]);
box(axes1,'on');
hold(axes1,'on');
% Create ylabel
ylabel('PWV (cm)','FontSize',14);
% Create axes
axes2 = axes('Parent',figure1,'HitTest','off','Color','none',...
'YTick',[0.94 0.96 0.98 1],...
'YAxisLocation','right', 'XTick',linspace(min(dvec_d) , max(dvec_d) , 24));
xlim(axes2,[min(dvec_d) max(dvec_d)]);
ylim(axes2,[0.94 1]);
hold(axes2,'on');
% Create ylabel
ylabel('MOD21 \epsilon_{29}','FontSize',14);
% Create bar
bar(dvec_d,pwv_d5,'FaceColor',[0.8 0.8 0.5],'EdgeColor',[0.5 0.99 0.9],'Parent',axes1);
%set(axes1, 'ydir', 'reverse'); % this will put hanging bars
set(axes1,'xtick',[])
set(axes1,'xticklabel',[])
hold on
% Create scatter
scatter(dvec_d,mod21_e295d, 'Parent',axes2,'MarkerEdgeColor',[1 0 0],'Marker','*');
set(axes2,'xtick',[])
set(axes2,'xticklabel',[])
set(axes2,'xticklabel',[])
% datetick('x','yyyy-mm' );.
datetick('x','yyyy-mm', 'keeplimits')
title(' PWV and Emissivity Time Series','FontSize',14); % add a title and define the font size
xlabel('Time ( 2003-2005)')
hold on
line( dvec_d, 1.5* ones(length(dvec_d)), 'Parent', axes1 )
set(axes2,{'ycolor'},{'r' })