Tuesday, January 13, 2015

Plotyy example #matlab #plot

A simple plotyy command for matlab to plot two data on y axis.
figure;
[ax,h1,h2] = plotyy(date,data1,date,data2);
% AX(2) = [];
set(h1,  'Markerfacecolor','k','Markersize',3)
set(h2, 'Markerfacecolor','b','Markersize',3)
% set(AX,'XAxisLocation','top', 'XTickLabel',[])
datetick('x',12,'keeplimits','keepticks')
set(ax(2),'XAxisLocation','bottom','XTickLabel',[]);
set(h1, 'Marker', 'o', 'LineStyle', 'none', 'MarkerSize', 3);
set(h2, 'Marker', '*', 'LineStyle', 'none', 'MarkerSize', 3);
title(tit);
ylabel(ax(1),'asdf(cm)') % left y-axis
ylabel(ax(2),'ttt') % right y-axis

No comments: