octave-maintainers
[Top][All Lists]
Advanced

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

Re: ylabel rotation


From: John W. Eaton
Subject: Re: ylabel rotation
Date: Thu, 29 Jan 2009 17:24:53 -0500

On 29-Jan-2009, Ben Abbott wrote:

| >No, it was intended.  The idea was that the {x,y,z}label functions
| >should not be creating new text objects, but should simply set values
| >in the existing text object that is a child of the axes object, and
| >that those objects should be created with the proper defaults.  I
| >thought I also made that change.  When I execute
| >
| >  get (get (gca, 'ylabel'), 'rotation')
| >
| >I get 90 and ylabel ('foo') sets foo as the label and it is rotated.
| >So it seems to be working for me.  In what cases does it fail?
| >
| >jwe
| 
| Before commenting further, I should compile and make sure my build isn't out 
of date.
| 
| I'll report back in an hour or two.

I think I see the problem.  It happens with

  plot (1:10)
  ylabel ("foo")

but not some other cases.  Anyway, does the following change fix it
for you?  It seems to work for me, so I checked it in.

Thanks,

jwe


 HG changeset patch
# User John W. Eaton <address@hidden>
# Date 1233267524 18000
# Node ID ee70d438a5b41d7242103f2b70f19a04418bdb9c
# Parent  bef8f001032f792df1d4ec22e58042aff73e7eac
[mq]: grfx

diff --git a/src/ChangeLog b/src/ChangeLog
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,4 +1,8 @@
 2009-01-29  John W. Eaton  <address@hidden>
+
+       * graphics.cc (properties::set_defaults): Also set
+       horizontalalignment, verticalalignmnt, and rotation properties for
+       new label objects here.
 
        * ov-base-scalar.cc (octave_base_scalar<ST>::is_true (void) const):
        Error if scalar is NaN.
diff --git a/src/graphics.cc b/src/graphics.cc
--- a/src/graphics.cc
+++ b/src/graphics.cc
@@ -2550,19 +2550,27 @@
   xlabel = gh_manager::make_graphics_handle ("text", __myhandle__, false);
   ylabel = gh_manager::make_graphics_handle ("text", __myhandle__, false);
   zlabel = gh_manager::make_graphics_handle ("text", __myhandle__, false);
-
   title = gh_manager::make_graphics_handle ("text", __myhandle__, false);
 
   xset (xlabel.handle_value (), "handlevisibility", "off");
   xset (ylabel.handle_value (), "handlevisibility", "off");
   xset (zlabel.handle_value (), "handlevisibility", "off");
-
   xset (title.handle_value (), "handlevisibility", "off");
+
+  xset (xlabel.handle_value (), "horizontalalignment", "center");
+  xset (ylabel.handle_value (), "horizontalalignment", "center");
+  xset (zlabel.handle_value (), "horizontalalignment", "right");
+  xset (title.handle_value (), "horizontalalignment", "center");
+
+  xset (xlabel.handle_value (), "verticalalignment", "cap");
+  xset (ylabel.handle_value (), "verticalalignment", "bottom");
+  xset (title.handle_value (), "verticalalignment", "bottom");
+
+  xset (ylabel.handle_value (), "rotation", 90.0);
 
   adopt (xlabel.handle_value ());
   adopt (ylabel.handle_value ());
   adopt (zlabel.handle_value ());
-
   adopt (title.handle_value ());
 
   update_transform ();
 
# HG changeset patch
# User John W. Eaton <address@hidden>
# Date 1233267524 18000
# Node ID ee70d438a5b41d7242103f2b70f19a04418bdb9c
# Parent  bef8f001032f792df1d4ec22e58042aff73e7eac
[mq]: grfx

diff --git a/src/ChangeLog b/src/ChangeLog
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,4 +1,8 @@
 2009-01-29  John W. Eaton  <address@hidden>
+
+       * graphics.cc (properties::set_defaults): Also set
+       horizontalalignment, verticalalignmnt, and rotation properties for
+       new label objects here.
 
        * ov-base-scalar.cc (octave_base_scalar<ST>::is_true (void) const):
        Error if scalar is NaN.
diff --git a/src/graphics.cc b/src/graphics.cc
--- a/src/graphics.cc
+++ b/src/graphics.cc
@@ -2550,19 +2550,27 @@
   xlabel = gh_manager::make_graphics_handle ("text", __myhandle__, false);
   ylabel = gh_manager::make_graphics_handle ("text", __myhandle__, false);
   zlabel = gh_manager::make_graphics_handle ("text", __myhandle__, false);
-
   title = gh_manager::make_graphics_handle ("text", __myhandle__, false);
 
   xset (xlabel.handle_value (), "handlevisibility", "off");
   xset (ylabel.handle_value (), "handlevisibility", "off");
   xset (zlabel.handle_value (), "handlevisibility", "off");
-
   xset (title.handle_value (), "handlevisibility", "off");
+
+  xset (xlabel.handle_value (), "horizontalalignment", "center");
+  xset (ylabel.handle_value (), "horizontalalignment", "center");
+  xset (zlabel.handle_value (), "horizontalalignment", "right");
+  xset (title.handle_value (), "horizontalalignment", "center");
+
+  xset (xlabel.handle_value (), "verticalalignment", "cap");
+  xset (ylabel.handle_value (), "verticalalignment", "bottom");
+  xset (title.handle_value (), "verticalalignment", "bottom");
+
+  xset (ylabel.handle_value (), "rotation", 90.0);
 
   adopt (xlabel.handle_value ());
   adopt (ylabel.handle_value ());
   adopt (zlabel.handle_value ());
-
   adopt (title.handle_value ());
 
   update_transform ();

reply via email to

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