octave-maintainers
[Top][All Lists]
Advanced

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

Re: legend and bar?


From: David Bateman
Subject: Re: legend and bar?
Date: Fri, 09 Nov 2007 17:12:40 +0100
User-agent: Thunderbird 1.5.0.7 (X11/20060921)

Opps, sorry forgot the modification to the __bar__.m to allow legends to
work. Updated patch attached..

D.


-- 
David Bateman                                address@hidden
Motorola Labs - Paris                        +33 1 69 35 48 04 (Ph) 
Parc Les Algorithmes, Commune de St Aubin    +33 6 72 01 06 33 (Mob) 
91193 Gif-Sur-Yvette FRANCE                  +33 1 69 35 77 01 (Fax) 

The information contained in this communication has been classified as: 

[x] General Business Information 
[ ] Motorola Internal Use Only 
[ ] Motorola Confidential Proprietary

*** ./scripts/plot/legend.m.orig16      2007-11-09 16:54:48.297176477 +0100
--- ./scripts/plot/legend.m     2007-11-09 16:54:19.909588215 +0100
***************
*** 59,69 ****
  ##
  ## Some specific functions are directly available using @var{func}:
  ##
! ## @table @code
  ## @item "show"
  ##   Show legends from the plot
  ## @item "hide"
! ## @itemx off
  ##   Hide legends from the plot
  ## @item "boxon"
  ##   Draw a box around legends
--- 59,69 ----
  ##
  ## Some specific functions are directly available using @var{func}:
  ##
! ## @table @asis
  ## @item "show"
  ##   Show legends from the plot
  ## @item "hide"
! ## @itemx "off"
  ##   Hide legends from the plot
  ## @item "boxon"
  ##   Draw a box around legends
***************
*** 158,164 ****
    if (nargs > 0)
      have_data = false;
      for i = 1:nkids
!       if (strcmp (get (kids(k), "type"), "line"))
        have_data = true;
        break;
        endif
--- 158,166 ----
    if (nargs > 0)
      have_data = false;
      for i = 1:nkids
!       if (strcmp (get (kids(k), "type"), "line") ||
!         strcmp (get (kids(k), "type"), "surface") ||
!         strcmp (get (kids(k), "type"), "patch"))
        have_data = true;
        break;
        endif
***************
*** 172,178 ****
    for i = 1:nargs
      arg = varargin{i};
      if (ischar (arg))
!       while (k <= nkids && ! strcmp (get (kids(k), "type"), "line"))
        k++;
        endwhile
        if (k <= nkids)
--- 174,182 ----
    for i = 1:nargs
      arg = varargin{i};
      if (ischar (arg))
!       while (k <= nkids && ! (strcmp (get (kids(k), "type"), "line") ||
!                             strcmp (get (kids(k), "type"), "surface") ||
!                             strcmp (get (kids(k), "type"), "patch")))
        k++;
        endwhile
        if (k <= nkids)
*** ./scripts/plot/__bar__.m.orig16     2007-11-09 17:09:05.967502337 +0100
--- ./scripts/plot/__bar__.m    2007-11-09 17:08:41.113739839 +0100
***************
*** 136,165 ****
    xb = reshape (xb, 4, numel (xb) /  4);
    yb = reshape (yb, 4, numel (yb) /  4);
  
!   if (! have_line_spec)
!     colors = [1, 0, 0; 0, 1, 0; 0, 0, 1; 1, 1, 0; 1, 0, 1; 0, 1, 1];
!     newargs = [{shiftdim(colors (mod (floor ([0 : (ycols * ylen - 1)] / 
ylen), 
!                                     6) + 1, :), -1)}, newargs];
!   endif
! 
    if (vertical)
!     if (nargout < 1)
        newplot ();
!       patch (xb, yb, newargs {:});
!     elseif (nargout < 2)
!       newplot ();
!       varargout{1} = patch (xb, yb, newargs {:});
      else
        varargout{1} = xb;
        varargout{2} = yb;
      endif
    else
!     if (nargout < 1)
!       newplot ();
!       patch (yb, xb, newargs{:});
!     elseif (nargout < 2)
        newplot ();
!       varargout{1} = patch (yb, xb, newargs{:});
      else
        varargout{1} = yb;
        varargout{2} = xb;
--- 136,174 ----
    xb = reshape (xb, 4, numel (xb) /  4);
    yb = reshape (yb, 4, numel (yb) /  4);
  
!   color = [1, 0, 0; 0, 1, 0; 0, 0, 1; 1, 1, 0; 1, 0, 1; 0, 1, 1];
    if (vertical)
!     if (nargout < 2)
        newplot ();
!       tmp = [];
!       for i = 1 : ycols
!       if (! have_line_spec)
!         tmp = [tmp; patch(xb(:,i), yb(:,i), color (i, :), newargs {:})];
!       else
!         tmp = [tmp; patch(xb(:,i), yb(:,i), newargs {:})];
!       endif
!       endfor
!       if (nargout == 1)
!       varargout{1} = tmp;
!       endif
      else
        varargout{1} = xb;
        varargout{2} = yb;
      endif
    else
!     if (nargout < 2)
        newplot ();
!       tmp = [];
!       for i = 1 : ycols
!       if (! have_line_spec)
!         tmp = [tmp; patch(yb(:,i), xb(:,i), color (i, :), newargs {:})];
!       else
!         tmp = [tmp; patch(yb(:,i), xb(:,i), newargs {:})];
!       endif
!       endfor
!       if (nargout == 1)
!       varargout{1} = tmp;
!       endif
      else
        varargout{1} = yb;
        varargout{2} = xb;
*** ./scripts/plot/__go_draw_axes__.m.orig16    2007-11-09 15:59:49.622100766 
+0100
--- ./scripts/plot/__go_draw_axes__.m   2007-11-09 17:10:03.172653890 +0100
***************
*** 456,462 ****
             is_image_data(data_idx) = false;
             parametric(data_idx) = false;
             have_cdata(data_idx) = false;
!              titlespec{data_idx} = "title \"\"";
             usingclause{data_idx} = "";
               if (isfield (obj, "facecolor") && isfield (obj, "cdata"))
                 if (strncmp (obj.facecolor, "none", 4))
--- 456,467 ----
             is_image_data(data_idx) = false;
             parametric(data_idx) = false;
             have_cdata(data_idx) = false;
!            if (isempty (obj.keylabel))
!              titlespec{data_idx} = "title \"\"";
!            else
!              tmp = undo_string_escapes (obj.keylabel);
!              titlespec{data_idx} = strcat ("title \"", tmp, "\"");
!            endif
             usingclause{data_idx} = "";
               if (isfield (obj, "facecolor") && isfield (obj, "cdata"))
                 if (strncmp (obj.facecolor, "none", 4))
*** ./src/graphics.cc.orig16    2007-11-09 15:57:50.617632018 +0100
--- ./src/graphics.cc   2007-11-09 16:09:54.186917623 +0100
***************
*** 2138,2144 ****
      marker ("none"),
      markeredgecolor ("auto"),
      markerfacecolor ("none"),
!     markersize (1)
  { }
  
  void
--- 2138,2145 ----
      marker ("none"),
      markeredgecolor ("auto"),
      markerfacecolor ("none"),
!     markersize (1),
!     keylabel ("")
  { }
  
  void
***************
*** 2186,2191 ****
--- 2187,2194 ----
      set_markerfacecolor (val);
    else if (name.compare ("markersize"))
      set_markersize (val);
+   else if (name.compare ("keylabel"))
+     set_keylabel (val);
    else
      {
        modified = false;
***************
*** 2220,2225 ****
--- 2223,2229 ----
    m.assign ("markeredgecolor", markeredgecolor);
    m.assign ("markerface", markerfacecolor);
    m.assign ("markersize", markersize);
+   m.assign ("keylabel", keylabel);
  
    return m;
  }
***************
*** 2267,2272 ****
--- 2271,2278 ----
      retval = markerfacecolor;
    else if (name.compare ("markersize"))
      retval = markersize;
+   else if (name.compare ("keylabel"))
+     retval = keylabel;
    else
      warning ("get: invalid property `%s'", name.c_str ());
  
***************
*** 2293,2299 ****
    m["markeredgecolor"] = "auto";
    m["markerfacecolor"] = "none";
    m["markersize"] = 1;
! 
  
    return m;
  }
--- 2299,2305 ----
    m["markeredgecolor"] = "auto";
    m["markerfacecolor"] = "none";
    m["markersize"] = 1;
!   m["keylabel"] = "";
  
    return m;
  }
*** ./src/graphics.h.in.orig16  2007-11-09 15:59:15.653578217 +0100
--- ./src/graphics.h.in 2007-11-09 15:59:01.325263108 +0100
***************
*** 1606,1611 ****
--- 1606,1612 ----
        octave_value markeredgecolor
        octave_value markerfacecolor
        octave_value markersize
+       octave_value keylabel
      END_PROPERTIES
  
      static std::string go_name;
2007-11-09  David Bateman  <address@hidden>

        * plot/legend.m: Also allow labels for surface and patch types.
        * plot/__bar__.m: Split into separate patch pbjects to allow
        setting of the legend.
        * plot/__go_draw_axes__.m: Set titlespec from keylabel for patch
        objects as well.

2007-11-09  David Bateman  <address@hidden>

        * graphics.cc (class patch), graphics.h.in (class patch): Add the 
        field "keylabel".

reply via email to

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