Reputation: 61
I have created two plots on a single GUI file in matlab. I wish to label each plot as follows; first plot: the label of x axis is position, y axis is concentration: second plot: the label of x axis is time, y axis is concentration: The problem is that the second plot is not getting its label
Code:
C = {'k','b','r','g','y',[.5 .6 .7],[.8 .2 .6]}; % Cell array of colorss.
phandles = plot(tott,XX(rown,:),'color',C{ind},'parent',handles.axes2);
hold on
xlabel('time');
ylabel('Concentration (mol/m3)');
title('concentration at given position vs time') axis([tott(1),tott(length(tott)),0,conc])
Upvotes: 1
Views: 862
Reputation: 1960
The xlabel article shows you how to change the labels using the plot handle (in this case your phandles
). Get the handle of your 2nd plot and use the following toy example as a reference or post your code for your second plot so I can clarify.
ax1 = subplot(2,1,1);
plot((1:10).^2)
xlabel(ax1,'Population')
ax2 = subplot(2,1,2);
plot((1:10).^3)
The variable returned when calling subplot
is the handle for the plot. Essentially if your 2nd handle is called phandles2
, then you can simply use:
xlabel(phandles2,'X Axis label for Plot 2');
ylabel(phandles2,'X Axis label for Plot 2');
Please post your code for your 2nd plot for a more detailed answer.
Upvotes: 1