Article View: comp.soft-sys.matlab
Article #137Re: trying to do a simple plot
From: Brian Fitzgerald
Date: Tue, 16 Mar 1993 04:02
Date: Tue, 16 Mar 1993 04:02
59 lines
1659 bytes
1659 bytes
J. Eric Townsend writes:
>
>I realize that I can label the axis, but what I'd like to do is have a
>little section at the top of the graph with something like:
>N (little line of color 1)
>O (little line of color 2)
>P (little line of color 3)
Try:
function plotlegend(textv)
%plotlegend
%
% usage: plotlegend(['N';'O';'P' ... ])
%
% Brian P. Fitzgerald
% Mechanics of Materials Laboratory
% Rensselaer Polytechnic Institute
% March 15, 1993
ax_save=gca;
kids=get(gca,'Children');
x = .2;
y = .8;
xw = .3;
yw = .05;
i = 1;
for kid = kids'
if strcmp(get(kids(1),'Type'),'line') == 1
color = get(kid,'Color');
linestyle = get(kid,'Linestyle');
rect = [x , y, xw, yw];
ax = axes('position', rect);
curve = plot([ 0 0.4],[0.5 0.5]);
set(ax,'XLim',[0 1],'YLim',[0 1],...
'XLimMode','manual','YLimMode','manual',...
'Box','off','XColor','k','YColor','k')
set(curve, 'Color', color, 'Linestyle', linestyle)
th = text(0.5,.5,textv(i));
i = i + 1;
y = y - .05;
end
end
axes(ax_save)
-----
(Yuck.)
RFD Comp.sources.matlab anyone?
Brian
Follow-up to comp.soft-sys.matlab
Technical Details
Message-ID:
<b+24gjq@rpi.edu>Path:
arc1-ca.pugleaf.net!wupost!usc!rpi!fitzgbReferences:
<JET.93Mar15164410@boxer.nas.nasa.gov>Show Full Headers
Complete Article Headers
Newsgroups: comp.soft-sys.matlab,alt.sources,news.groups Path: arc1-ca.pugleaf.net!wupost!usc!rpi!fitzgb From: fitzgb@mml0.meche.rpi.edu (Brian Fitzgerald) Subject: Re: trying to do a simple plot Message-ID: <b+24gjq@rpi.edu> Followup-To: comp.soft-sys.matlab Nntp-Posting-Host: mml0.meche.rpi.edu Organization: Rensselaer Polytechnic Institute, Troy, NY References: <JET.93Mar15164410@boxer.nas.nasa.gov> Date: Tue, 16 Mar 1993 04:02:29 GMT Lines: 61