

%This example creates a graph to display two separate sets of data using the bottom and left sides as the x- and y-axis for one, and the top and right sides as the x- and y-axis for the other. 

%Using low-level line and axes routines allows you to superimpose objects easily. Plot the first data, making the color of the line and the corresponding x- and y-axis the same to more easily associate them. 
hl1 = line(x1,y1,'Color','r');
ax1 = gca;
set(ax1,'XColor','r','YColor','r')



%Next, create another axes at the same location as the first, placing the x-axis on top and the y-axis on the right. Set the axes Color to none to allow the first axes to be visible and color code the x- and y-axis to match the data. 
ax2 = axes('Position',get(ax1,'Position'),...
           'XAxisLocation','top',...
           'YAxisLocation','right',...
           'Color','none',...
           'XColor','k','YColor','k');



%Draw the second set of data in the same color as the x- and y-axis. 
hl2 = line(x2,y2,'Color','k','Parent',ax2);