octave-maintainers
[Top][All Lists]
Advanced

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

Re: plotyy problems and change proposal


From: David Bateman
Subject: Re: plotyy problems and change proposal
Date: Sun, 02 Dec 2007 22:45:13 +0100
User-agent: Thunderbird 1.5.0.7 (X11/20060921)

Michael Goffioul wrote:

> You don't really need listeners for this. It would be enough to set the
> position to something reasonable. [0 0 1 1] is not a good value for
> position in normalized units. Just use something else and it should be
> fine with JHandles: for instance, typical value used in JHandles is
> [0.11 0.13 0.78 0.73] (altough it looks a little bit to small).

What I meant is that there is nothing to stop you changing the
properties of one of the axis objects and that without listeners there
is no way to get these changes automatically reflected in the second set
of axis. In fact its probably better for the gnuplot code to calculate
the size of the axis automatically for first axis and use that to force
the size of the second axis..


>>> 2) the second axes should get "color" set to "none", otherwise you don't
>>> see the first axes behind it.
>> There is no color property of the axes in Octave at the moment, only
>> {x|y|z}color. I see no issue adding that either I suppose.. I'll see
>> what I can do, though it might take a couple of days so feel free to
>> propose a patcn..
> 
> I don't have that much time neither this weekend...
> 

Alright, then what about the attached. Does this do what you want?

D.
*** ./scripts/plot/plotyy.m.orig41      2007-12-02 21:05:09.652248667 +0100
--- ./scripts/plot/plotyy.m     2007-12-02 22:09:15.610791195 +0100
***************
*** 95,101 ****
    h1 = feval (fun1, x1, y1);
  
    set (ax(1), "ycolor", getcolor (h1(1)));
!   set (ax(1), "position", get (ax(1), "outerposition"));
    set (ax(1), "xlim", xlim);
  
    cf = gcf ();
--- 95,102 ----
    h1 = feval (fun1, x1, y1);
  
    set (ax(1), "ycolor", getcolor (h1(1)));
!   set (ax(1), "position", [0.11 0.13 0.78 0.73]);
!   set (ax(1), "activepositionproperty", "position");
    set (ax(1), "xlim", xlim);
  
    cf = gcf ();
***************
*** 107,114 ****
    h2 = feval (fun2, x2, y2);
    set (ax(2), "yaxislocation", "right");
    set (ax(2), "ycolor", getcolor (h2(1)));
!   set (ax(2), "position", get (ax(1), "outerposition"));
    set (ax(2), "xlim", xlim);
  endfunction
  
  function color = getcolor (ax)
--- 108,117 ----
    h2 = feval (fun2, x2, y2);
    set (ax(2), "yaxislocation", "right");
    set (ax(2), "ycolor", getcolor (h2(1)));
!   set (ax(2), "position", [0.11 0.13 0.78 0.73]);
!   set (ax(2), "activepositionproperty", "position");
    set (ax(2), "xlim", xlim);
+   set (ax(2), "color", "none");
  endfunction
  
  function color = getcolor (ax)
*** ./scripts/plot/__go_draw_axes__.m.orig41    2007-12-02 21:04:00.021859809 
+0100
--- ./scripts/plot/__go_draw_axes__.m   2007-12-02 22:36:33.310857488 +0100
***************
*** 33,50 ****
  
      ## Set axis properties here?
      pos = [0, 0, 1, 1];
!     if (! isempty (axis_obj.outerposition))
!       pos = axis_obj.outerposition;
!     endif
! 
!     ymirror = true;
!     if (! isempty (axis_obj.position))
!       pos = axis_obj.position;
!       fprintf (plot_stream, "set tmargin 3;\n");
!       fprintf (plot_stream, "set bmargin 3;\n");
!       fprintf (plot_stream, "set lmargin 10;\n");
!       fprintf (plot_stream, "set rmargin 10;\n");
        ymirror = false;
      endif
  
      if (! strcmp (axis_obj.__colorbar__, "none"))
--- 33,52 ----
  
      ## Set axis properties here?
      pos = [0, 0, 1, 1];
!     if (strcmp (axis_obj.activepositionproperty, "outerposition"))
!       ymirror = true;
!       if (! isempty (axis_obj.outerposition))
!       pos = axis_obj.outerposition;
!       endif
!     else
        ymirror = false;
+       if (! isempty (axis_obj.position))
+       pos = axis_obj.position;
+       fprintf (plot_stream, "set tmargin 0;\n");
+       fprintf (plot_stream, "set bmargin 0;\n");
+       fprintf (plot_stream, "set lmargin 0;\n");
+       fprintf (plot_stream, "set rmargin 0;\n");
+       endif
      endif
  
      if (! strcmp (axis_obj.__colorbar__, "none"))
*** ./src/graphics.h.in.orig41  2007-12-02 20:45:20.220934450 +0100
--- ./src/graphics.h.in 2007-12-02 22:12:51.736582571 +0100
***************
*** 1376,1381 ****
--- 1376,1382 ----
        octave_value xticklabelmode
        octave_value yticklabelmode
        octave_value zticklabelmode
+       color_property color a
        color_property xcolor
        color_property ycolor
        color_property zcolor
***************
*** 1391,1396 ****
--- 1392,1398 ----
        octave_value visible
        octave_value nextplot
        octave_value outerposition
+       radio_property activepositionproperty a
        radio_property __colorbar__ a
     END_PROPERTIES
  
*** ./src/graphics.cc.orig41    2007-12-02 20:45:10.941415700 +0100
--- ./src/graphics.cc   2007-12-02 22:26:02.306582365 +0100
***************
*** 1114,1119 ****
--- 1114,1120 ----
      xticklabelmode ("auto"),
      yticklabelmode ("auto"),
      zticklabelmode ("auto"),
+     color (color_values(0, 0, 0), radio_values ("flat|none|interp")),
      xcolor (),
      ycolor (),
      zcolor (),
***************
*** 1129,1134 ****
--- 1130,1136 ----
      visible ("on"),
      nextplot ("replace"),
      outerposition (),
+     activepositionproperty (radio_values ("{outerposition}|position")),
      __colorbar__ (radio_values 
("{none}|north|south|east|west|northoutside|southoutside|eastoutside|westoutside"))
  {
    Matrix tlim (1, 2, 0.0);
***************
*** 1306,1311 ****
--- 1308,1315 ----
      set_yticklabelmode (val);
    else if (name.compare ("zticklabelmode"))
      set_zticklabelmode (val);
+   else if (name.compare ("color"))
+     set_color (val);
    else if (name.compare ("xcolor"))
      set_xcolor (val);
    else if (name.compare ("ycolor"))
***************
*** 1336,1341 ****
--- 1340,1347 ----
      set_nextplot (val);
    else if (name.compare ("outerposition"))
      set_outerposition (val);
+   else if (name.compare ("activepositionproperty"))
+     set_activepositionproperty (val);
    else if (name.compare ("__colorbar__"))
      set___colorbar__ (val);
    else
***************
*** 1397,1402 ****
--- 1403,1409 ----
    xticklabelmode = "auto";
    yticklabelmode = "auto";
    zticklabelmode = "auto";
+   color = color_property (color_values (0, 0, 0), 
radio_values("flat|none|interp"));
    xcolor = color_property ("black");
    ycolor = color_property ("black");
    zcolor = color_property ("black");
***************
*** 1427,1432 ****
--- 1434,1440 ----
        outerposition = touterposition;
      }
  
+   activepositionproperty = radio_property (radio_values 
("{outerposition}|position"));
    __colorbar__  = radio_property (radio_values 
("{none}|north|south|east|west|northoutside|southoutside|eastoutside|westoutside"));
  
    delete_children ();
***************
*** 1520,1525 ****
--- 1528,1534 ----
    m.assign ("xticklabelmode", xticklabelmode);
    m.assign ("yticklabelmode", yticklabelmode);
    m.assign ("zticklabelmode", zticklabelmode);
+   m.assign ("color", color);
    m.assign ("xcolor", xcolor);
    m.assign ("ycolor", ycolor);
    m.assign ("zcolor", zcolor);
***************
*** 1535,1540 ****
--- 1544,1550 ----
    m.assign ("visible", visible);
    m.assign ("nextplot", nextplot);
    m.assign ("outerposition", outerposition);
+   m.assign ("activepositionproperty", activepositionproperty);
    m.assign ("__colorbar__", __colorbar__);
  
    return m;
***************
*** 1631,1636 ****
--- 1641,1648 ----
      retval = yticklabelmode;
    else if (name.compare ("zticklabelmode"))
      retval = zticklabelmode;
+   else if (name.compare ("color"))
+     retval = color;
    else if (name.compare ("xcolor"))
      retval = xcolor;
    else if (name.compare ("ycolor"))
***************
*** 1661,1666 ****
--- 1673,1680 ----
      retval = nextplot;
    else if (name.compare ("outerposition"))
      retval = outerposition;
+   else if (name.compare ("activepositionproperty"))
+     retval = activepositionproperty;
    else if (name.compare ("__colorbar__"))
      retval = __colorbar__;
    else
***************
*** 1747,1752 ****
--- 1761,1767 ----
    m["xticklabelmode"] = "auto";
    m["yticklabelmode"] = "auto";
    m["zticklabelmode"] = "auto";
+   m["color"] = color_property (color_values (0, 0, 0), 
radio_values("flat|none|interp"));
    m["xcolor"] = color_property ("black");
    m["ycolor"] = color_property ("black");
    m["zcolor"] = color_property ("black");
***************
*** 1772,1777 ****
--- 1787,1793 ----
    touterposition(3) = 1;
  
    m["outerposition"] = touterposition;
+   m["activepositionproperty"] =  radio_property (radio_values 
("{outerposition}|position"));
    m["__colorbar__"] = radio_property (radio_values 
("{none}|north|south|east|west|northoutside|southoutside|eastoutside|westoutside"));
  
    return m;
2007-12-02  David Bateman  <address@hidden>

        * plot/plotyy.m: Use activepositionproperty property of axes
        object. Set second axis color to "none".
        * plot/__go_draw_axes__.m: Respect the activepositionproperty
        property of the axis objects.

2007-12-02  David Bateman  <address@hidden>

        * graphics.cc (class axes): Add color and activepositionproperty
        properties to axis objects.
        * graphics.h.in (class axes): ditto.

reply via email to

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