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:04:22 +0100
User-agent: Thunderbird 1.5.0.7 (X11/20060921)

John W. Eaton wrote:
> On  5-Nov-2007, David Bateman wrote:
>
> | John W. Eaton wrote:
> | > On  5-Nov-2007, David Bateman wrote:
> | >
> | > | though it probably
> | > | makes more sense to just bite the bullet and implement the bar series
> | > | objects in a matlab compatible way.
> | >
> | > Can this wait until after 3.0?
> | >
> | > jwe
> | >
> | >   
> | Sure, the downside is that legends won't work for bar plots.. A quick
> | workaround that might have future compatibility problems might be to add
> | a "KeyLabel" field to the patch/surface objects and adjust legend.m to
> | take these into account. So which of the three solutions do you want
> | 
> | 1) Ignore it
> | 2) Add KeyLabel field to patch/surface
> | 3) Add BarSeries objects
>
> I think I'd prefer to have 3 eventually, but we have to draw the line
> somewhere and release 3.0.  We could go on for years (as we have
> already) fixing the N remaining compatibility problems.  There is no
> way for 3.0 to be perfect and fix everything, so I guess I'm just
> asking whether this is important enough to delay the release by
> another month (or more, since if we fix this problem, why not fix
> others?).
>
> jwe
>
>
>   
John,

If you accept the area function I just sent, then we have several
functions with the same issue. I'd therefore prefer to implement 2)
above for Octave 3.0, to allow legends to work for bar and area plots..
Can you consider the attached patch. This doesn't introduce any new
incompatibilities I believe as the keylabel field isn't in matlab
surface objects either.. and it is in Octave..

Regards
David

-- 
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/__go_draw_axes__.m.orig16    2007-11-09 15:59:49.622100766 
+0100
--- ./scripts/plot/__go_draw_axes__.m   2007-11-09 16:03:51.784205501 +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/__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]