help-octave
[Top][All Lists]
Advanced

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

Re: patch(...) swallows tick marks


From: John W. Eaton
Subject: Re: patch(...) swallows tick marks
Date: Wed, 12 Dec 2007 13:44:21 -0500

On 12-Dec-2007, Michael Goffioul wrote:

| On 12/12/07, kahacjde <address@hidden> wrote:
| >
| >
| > Matthias Brennwald (bwm) wrote:
| > >
| > > Dear all
| > >
| > > If I plot a patch that extends to the axes of a plot, the tick marks get
| > > covered by the patch. A simple example to illustrate this effect is:
| > >
| > > ------------------
| > > clf
| > > patch ([5.5 10 10 5.5],[1 1 10 10],'r'); hold on
| > > plot(1:10)
| > > ------------------
| > >
| > > Is there a way to make the tick marks visible again?
| > >
| > > (I have Octave 2.9.18 with gnuplot 4.2)
| > >
| > > Matthias
| > >
| >
| > Hello,
| >
| > with matlab I see the same behavior - the patch is plotted above the grid
| > and tick marks.
| 
| In Matlab, you would do a
| 
| set(gca, 'Layer', 'top')
| 
| to see the tick marks again (only in 2D mode). This is supported in JHandles
| plot backend.

I made the following change.

Thanks,

jwe


scripts/ChangeLog:

2007-12-12  John W. Eaton  <address@hidden>

        * plot/__go_draw_axes__.m: Handle the axes layer property.


src/ChangeLog:

2007-12-12  John W. Eaton  <address@hidden>

        * graphics.h.in (class axes) Add the layer property.
        * graphics.cc (class axes) Ditto.


Index: scripts/plot/__go_draw_axes__.m
===================================================================
RCS file: /cvs/octave/scripts/plot/__go_draw_axes__.m,v
retrieving revision 1.92
diff -u -u -r1.92 __go_draw_axes__.m
--- scripts/plot/__go_draw_axes__.m     11 Dec 2007 21:25:53 -0000      1.92
+++ scripts/plot/__go_draw_axes__.m     12 Dec 2007 18:43:39 -0000
@@ -241,9 +241,13 @@
       fputs (plot_stream, "set grid nomztics;\n");
     endif
 
-    ## Unless we force the grid to the front, tics may appear below
-    ## plotted objects.
-    fputs (plot_stream, "set grid front;\n");
+    ## The grid front/back/layerdefault option also controls the
+    ## appearance of tics, so it is used even if the grid is absent.
+    if (strcmpi (axis_obj.layer, "top"))
+      fputs (plot_stream, "set grid front;\n");
+    else
+      fputs (plot_stream, "set grid layerdefault;\n");
+    endif
     if (! have_grid)
       fputs (plot_stream, "unset grid;\n");
     endif
Index: src/graphics.cc
===================================================================
RCS file: /cvs/octave/src/graphics.cc,v
retrieving revision 1.64
diff -u -u -r1.64 graphics.cc
--- src/graphics.cc     12 Dec 2007 16:41:09 -0000      1.64
+++ src/graphics.cc     12 Dec 2007 18:43:42 -0000
@@ -1098,6 +1098,7 @@
     colororder (default_colororder ()),
     dataaspectratio (Matrix (1, 3, 1.0)),
     dataaspectratiomode ("auto"),
+    layer (radio_values ("{bottom}|top")),
     xlim (),
     ylim (),
     zlim (),
@@ -1263,6 +1264,8 @@
     set_dataaspectratio (val);
   else if (name.compare ("dataaspectratiomode"))
     set_dataaspectratiomode (val);
+  else if (name.compare ("layer"))
+    set_layer (val);
   else if (name.compare ("xlim"))
     set_xlim (val);
   else if (name.compare ("ylim"))
@@ -1380,6 +1383,7 @@
   colororder = default_colororder ();
   dataaspectratio = Matrix (1, 3, 1.0);
   dataaspectratiomode = "auto";
+  layer = radio_property (radio_values ("{bottom}|top"));
 
   Matrix tlim (1, 2, 0.0);
   tlim(1) = 1;
@@ -1512,6 +1516,7 @@
   m.assign ("colororder", colororder);
   m.assign ("dataaspectratio", dataaspectratio);
   m.assign ("dataaspectratiomode", dataaspectratiomode);
+  m.assign ("layer", layer);
   m.assign ("xlim", xlim);
   m.assign ("ylim", ylim);
   m.assign ("zlim", zlim);
@@ -1596,6 +1601,8 @@
     retval = dataaspectratio;
   else if (name.compare ("dataaspectratiomode"))
     retval = dataaspectratiomode;
+  else if (name.compare ("layer"))
+    retval = layer;
   else if (name.compare ("xlim"))
     retval = xlim;
   else if (name.compare ("ylim"))
@@ -1736,6 +1743,7 @@
   m["colororder"] = default_colororder ();
   m["dataaspectratio"] = Matrix (1, 3, 1.0);
   m["dataaspectratiomode"] = "auto";
+  m["layer"] = radio_property (radio_values ("{bottom}|top"));
 
   Matrix tlim (1, 2, 0.0);
   tlim(1) = 1;
Index: src/graphics.h.in
===================================================================
RCS file: /cvs/octave/src/graphics.h.in,v
retrieving revision 1.27
diff -u -u -r1.27 graphics.h.in
--- src/graphics.h.in   11 Dec 2007 16:52:56 -0000      1.27
+++ src/graphics.h.in   12 Dec 2007 18:43:42 -0000
@@ -1360,6 +1360,7 @@
       octave_value colororder
       octave_value dataaspectratio m
       octave_value dataaspectratiomode
+      radio_property layer a
       octave_value xlim m
       octave_value ylim m
       octave_value zlim m

reply via email to

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