How to create and synchronize several axes

3 views (last 30 days)
I am creating several axes, both for the main and secondary axis. Normally axes change the value of their axes when an increase is applied to the graph. I am generating several axes with several axes and applying a minimum thickness that appears to be a line. The created axis prints the values corresponding to the data matrix, however, since they are different axes they are not synchronized at the time of applying a zoom.
Example:
yyaxis(graf1,'right')
plot(graf1,FechaPzs,Gasto/fact,'LineWidth',1.5,'Color',colores(1,:));
graf1.YColor='k';
graf1.XLabel.String='Datetime (Month/Year)';
graf1.XLabel.FontName='Century Gothic';
graf1.YLabel.FontName='Century Gothic';
graf1.XLabel.FontSize=14; graf1.YLabel.FontSize=14;
graf1.YTick=[];
title(graf1,titulo,'FontSize',15,'FontName', 'Century Gothic')
hold(graf1, 'on')
p=pos(1)+mm*(j-1)+pos(3);
pos12=[p pos(2) 0.001 pos(4)];
axe12=axes('Parent',p1,'position',pos12,'XAxisLocation','top','YAxisLocation','right',...
'Color','none','fontsize',12, 'XColor','b','YColor',colores(1,:));
set(get(axe12,'XLabel'),'String',strvcat(' ','yrggbn'),'Fontname','Century Gothic','Fontsize',12);
set(axe12,'Ylim',[min(Gasto) max(Gasto)])
inc2=abs(max(Gasto)-min(Gasto))/8;
my=min(Gasto):inc2:max(Gasto);
set(axe12,'Ytick',my)
ytickformat(axe12,'%.0f')

Answers (0)

Categories

Find more on Line Plots 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!