axes(handles.axes2); %make axes2 the current axis
x1=r (1,:);y1=C (1,:);y2=S(1,:);y3=R(1,:);y4=L(1,:);y5=T(1,:);y6=Q(1,:);y7=A(1,:);%Plot the followings in the current axis
hl1=line(x1, y1,'Color','r');hl2=line(x1, y2,'Color','b');hl3=line(x1, y3,'Color','m');hl4=line(x1, y4,'Color','m','Marker','o');hl5=line(x1, y5,'Color','c');hl6=line(x1, y6,'Color','k');grid ('on')legend ('r','c','s','R','T', 'Q');set (gca, 'XTick',0:10:100 );set (gca, 'YTick',0:10:80);xlabel ('A');ylabel ('B');xlim([Min_A Max_A]) %Optional input for Minimum and Maximum A
ylim([Min_B Max_B]) %Optional input for Minimum and Maximum B
handles.ax3=axes('Units','character'); %create a new axis and set units to be character
set(handles.ax3, 'Position',get(handles.axes2,'Position'),'YAxisLocation','right',… 'Color','none', 'YColor','k'); %position the new axis on axes2
linkaxes([handles.axes2 handles.ax3],'x'); %link x axis of axes2 and ax3
hl7=line(x1, y7,'Color','g','Parent',handles.ax3); % plot on ax3
ylabel (handles.ax3,'Angle [^{\circ}]')legend (handles.ax3,'Angle');
MATLAB: I used the following code to create a graph with two y axis. Everytime I push the execute button, the legend and values of left Y axis gets bolder and bolder as if the plot isn’t replaced and the more I push the botton, the slower gets matlab.
problem with second y axis in gui matlab
Best Answer