help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fill handle


From: PetrSt
Subject: Re: fill handle
Date: Fri, 22 Mar 2013 04:54:33 -0700 (PDT)

As I understand the code of "legend.m" (lines 683-715), colored line is added
only for graphic objects of type "line". The easiest way, how to put colors
into the legend, seems to me in plot lines, create legend and overlay the
plot by patch. Something like that:

figure;
 x = 0:0.1:7;
 hold on
 h(1) = plot (x, sin(x));
 h(2) = plot(x,cos(x),'r');
 h(3) = plot(x, sin(x.^2/10),'g');
 h(4) = plot(x, cos(x.^2/10),'k');
 title ("Only the sin() objects have keylabels");
 legend (h([1, 3]), {"sin(x)", "sin(x^2/10)"}, "location", "southwest");

nplots = length(h);
 h(nplots+1) = fill (x, sin(x));
set(h(nplots+1),'facecolor','b');%,'edgecolor','b');
 h(nplots+2) = fill(x,cos(x));
set(h(nplots+2),'facecolor','r');%,'edgecolor','r');
 h(nplots+3) = fill(x, sin(x.^2/10));
set(h(nplots+3),'facecolor','g');%,'edgecolor','g');
 h(nplots+4) = fill(x, cos(x.^2/10));
set(h(nplots+4),'facecolor','k');%,'edgecolor','k');

Since the dafault "edgecolor" of patches is [0 0 0] ('k'), you can use
'edgecolor' option to ensure the correct overlay of ploted lines.



--
View this message in context: 
http://octave.1599824.n4.nabble.com/fill-handle-tp4651111p4651116.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]