Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Ploting with legend
Replies: 1   Last Post: Apr 3, 2013 11:39 PM

 Messages: [ Previous | Next ]
 Saravanan Mani Posts: 78 Registered: 6/3/11
Re: Ploting with legend
Posted: Apr 3, 2013 11:39 PM

"M@lik Ali" wrote in message <kjiqlb\$n48\$1@newscl01ah.mathworks.com>...
> Hi all,
>
> I want to plot some data , through following code i can plot but i don't know how to put the legend at the bottom of the right corner
>
> MBA = [0.52 0.68 0.75 0.805 0.86 0.88 0.9 0.91 0.935];
> BDA = [0.53 0.695 0.705 0.715 0.725 0.751 0.77 0.78 0.79];
> plot(BDA, 'DisplayName', 'BDA', 'YDataSource', 'BDA'); hold all;
> plot(MBA, 'DisplayName', 'MBA', 'YDataSource', 'MBA');
>
> please help me how i can put the legend at the right bottom of the graph. also please tel me how to use the different symbols in the graph line.

Hello Malik,

Try this,

% Legend bottom right corner
MBA = [0.52 0.68 0.75 0.805 0.86 0.88 0.9 0.91 0.935];
BDA = [0.53 0.695 0.705 0.715 0.725 0.751 0.77 0.78 0.79];
plot(BDA, 'DisplayName', 'BDA', 'YDataSource', 'BDA'); hold all;
plot(MBA, 'DisplayName', 'MBA', 'YDataSource', 'MBA');
% Legend bottom right corner
legend('MBA','BDA',4)
% Plot Different symbols
% Example: you can use any symbols in inside the plot
text(4,0.71,'\leftarrow MBA',...
'HorizontalAlignment','left')

text(5,0.85,'\leftarrow BDA',...
'HorizontalAlignment','left')

Thanks & Regards,
Saravanan Mani

Date Subject Author