Double y-axis plot. Change properties of second axis

5 vues (au cours des 30 derniers jours)
David du Preez
David du Preez le 15 Août 2017
Réponse apportée : KL le 15 Août 2017
I am using MATLAB 2011B. I want to limit the second y-axis between 5 and 10 and I want ticks to occur every 2.5 units.
[ax h1 h2]=plotyy(SZA15_Sort(:,1),SZA15_Sort(:,9),SZA15_Sort(:,1),SZA15_Sort(:,5));
set(h1,'Color','k');
set(h1,'LineStyle',':');
set(h1,'Marker','*','MarkerSize',8)
set(h2,'Color','k');
set(h2,'LineStyle','-');
set(h2,'Marker','.','MarkerSize',8)
axes(ax(1));xlim([datenum(2008,12,13), datenum(2016,1,12)]);
datetick('x','yyyymmm','keeplimits');
axes(ax(2));xlim([datenum(2008,12,13), datenum(2016,1,12)]);
set(ax(2),'xtick',[]);
axes(ax(1));xlabel('Years')
axes(ax(1)); ylabel('Total Ozone Column (DU)');
set(ax(1),'ycolor', 'k');
axes(ax(2)); ylabel('UVI');
set(ax(2),'ycolor','k')
legend('TOC','UVI','Location','southeast')
set(legend,'color','none');
title('TOC vs UVI SZA15')
I tried several things but I understand that using plotty is not ideal. Is there a solution to this problem?

Réponse acceptée

KL
KL le 15 Août 2017
Just like how you've used xlim, it's ylim
set(ax(2),'ylim',[5 10]);
set(ax(2),'ytick',5:2.5:10);

Plus de réponses (0)

Catégories

En savoir plus sur Christmas / Winter 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