Effacer les filtres
Effacer les filtres

Plotyy - two x axes ticks not lining up correctly

1 vue (au cours des 30 derniers jours)
Aaron Burdick
Aaron Burdick le 9 Oct 2011
Hi there,
I am using the plotyy function to plot two sets of data using 2 y axes and 2 x axes. For some reason the tick marks from the bottom x axis are "bleeding" on to the top x axis as you can see in this picture:
Any reason why this might be happening? Here is the code I'm using:
% Create figure
figure1 = figure('XVisual','','Color',[1 1 1]);
% Create difpercent vector
difpercent = (difinput./basinput).*100;
% plotyy graph
[AX,H1,H2] = plotyy(basinput,bas_hpa,difpercent,dif_hpa,@semilogx,@plot)
set(AX(1),'XColor',[0 0 0],'YColor',[0 0 0],'Parent',figure1,...
'YTickLabel',{'200','400','600','800',''},...
'YTick',[200 400 600 800 1000],...
'YMinorTick','on',...
'YDir','reverse',...
'XMinorTick','off',...
'XTickMode','auto',...
'Position',[0.13 0.112403846153846 0.710158478605388 0.793461538461539],...
'FontSize',16,...
'FontName','Times');
axis auto;
set(H1,'Color',[0 0 0],'linewidth',2)
legend([,units,],'%','Location','Best')
% Create ylabel
ylabel('Pressure (hPa)','FontWeight','bold','FontSize',18,...
'FontName','Times');
% Create xlabel
xlabel([,xaxistitle,],'FontWeight','bold','FontSize',18,...
'FontName','Times');
% set properties for axis 2
set(AX(2),'XAxisLocation','top',...
'YAxisLocation','right',...
'YTick',[200 400 600 800 1000],...
'YTickLabel',{'11.8','7.18','4.20','1.95',''},...
'YMinorTick','on',...
'XMinorTick','off',...
'XTickMode','auto',...
'YDir','reverse',...
'FontSize',16,...
'FontName','Times',...
'Position',[0.13 0.112403846153846 0.710158478605388 0.793461538461539],...
'Color','none',...
'XColor','k','YColor','k');
% set Xlabel and Ylabel for axes 2
set(get(AX(2),'Ylabel'),'String','Altitude (km)','FontWeight','bold',...
'FontSize',18,...
'FontName','Times');
set(get(AX(2),'Xlabel'),'String',[,x2axistitle,],'FontWeight','bold',...
'FontSize',18,...
'FontName','Times');
% set H2 plot line properties
set(H2,'Color',[0 0 0],'linewidth',2,'linestyle',':')
% Set output size
set(gcf, 'units', 'pixels');
set(gcf, 'position', [200 150 650 550]);
THANK YOU!!!
Aaron
  3 commentaires
Aaron Burdick
Aaron Burdick le 9 Oct 2011
It's pretty much the same question. That one was related to Y axes and this one to X axes, but same issue.
Thanks.
Aaron Burdick
Aaron Burdick le 14 Oct 2011
No response to this? Is this simply a glitch in the program? Can Matlab not accurately do two Y axes and two X axes?
Aaron

Connectez-vous pour commenter.

Réponses (1)

Aaron Burdick
Aaron Burdick le 13 Oct 2011
No response to this? Is this simply a glitch in the program? Can Matlab not accurately do two Y axes and two X axes?
Aaron

Catégories

En savoir plus sur Two y-axis dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by