help-octave
[Top][All Lists]
Advanced

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

Re: [unclassified] Re: patch: Invalid call to __patch__


From: Kai Habel
Subject: Re: [unclassified] Re: patch: Invalid call to __patch__
Date: Mon, 24 Sep 2007 22:55:49 +0000
User-agent: IceDove 1.5.0.12 (X11/20070607)


Matthias Brennwald wrote:
> Dear all
>
> I just built and installed Octave 2.9.14 on my Ubuntu box and tried the > patch function that comes with it. However, this did not work (see > below). What am I doing wrong?
>
> Matthias
>
>
> --------------------
> octave:6> version
> ans = 2.9.14
> octave:7> patch(rand(1,4),rand(1,4),"r")
>
> Invalid call to __patch__.  Correct usage is:
>
>
The __patch__.m doesn't yet support colors passed as strings like that.
Try instead

patch(rand(1,4),rand(1,4),[1,0,0])

and it will work.. The patch attached will add the missing support..

D.


I am not in front of my PC, so I cannot check this now. But AFAIK the assignment of string values to a color-property (like here) should work again. Therefore, the color_values class should be used to convert a string to a rgb value. if (isstr (color_var)) ## Have color string. set (h, "FaceColor", color_var); I will look at this later today. Kai
The following patch should allow string values for 'FaceColor' for patch objects.

patch(rand(1,4),rand(1,4),"r")
should plot a red patch object.

Kai

2007-09-24  Kai Habel  <address@hidden>

   * plot/__patch__.m : Allow color string for patch



--- __patch__.m 2007-09-24 22:43:36.000000000 +0000
+++ __patch__.m.new     2007-09-24 22:36:16.000000000 +0000
@@ -51,7 +51,7 @@
     endif
   endif
 
-  if (have_x && nargin > iarg && isnumeric (varargin{iarg}))
+  if (have_x && nargin > iarg)
     c = varargin{iarg};
     have_c = true;
     iarg++;
@@ -111,6 +111,8 @@
            if (c2 > clim(2))
               set (ax, "clim", [clim(1), c2])
            endif
+          elseif (isstr (c2))
+            set (h, "facecolor", c2);
          else
            ## Unknown color value.
            error ("patch: color value not valid");

reply via email to

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