[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: stem series objects
From: |
David Bateman |
Subject: |
Re: stem series objects |
Date: |
Mon, 25 Aug 2008 14:22:12 +0200 |
User-agent: |
Thunderbird 2.0.0.16 (X11/20080725) |
Michael Goffioul wrote:
I had a quick look and have several comments:
1) when adding properties like linestyle or marker, it's easier
to use the possibility to inherit from existing property; for instance,
you can use (see addproperty documentation)
addproperty ("linestyle", hg, "linelinestyle", "-");
Ok, missed that. Consider the attached changeset that is applied after
my previous one that uses this feature instead.
2) why do you need to call drawnow explicitely? Normally the axes
limits are updated automatically when a child is added (and its
X/Y/Z data are set); there should be no need to call drawnow.
This was a hang over from the 3.0.x code where the axes limits were not
updated till the drawnow occurred. This is also fixed in the attached
additional changeset.
3) the off-by-1 error was intentional. In Matlab, callbacks are
always called with at least 2 arguments: the handle of the object
and an optional data specific to the event (for instance, a keypress
event will contain information about the key pressed). Then other
possible arguments are appended, in case the callback has the
form address@hidden, p1, p2, ...}
yes, but then I saw that the function call had to have the form
function fun (h, d, f, p1, p2)
rather than
function fun (h, d, p1, p2)
as I would have expected from the documentation. Are you sure of your
explanation? In any case I left my change to this in for now.
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
# HG changeset patch
# User David Bateman <address@hidden>
# Date 1219666881 -7200
# Node ID 4706f7cdb217de329da0669932043aedb9ad6567
# Parent 6e07cde51584fe436a0ad591f24323813b346e29
Use property inheritance and don't call drawnow in __stem__
diff --git a/scripts/ChangeLog b/scripts/ChangeLog
--- a/scripts/ChangeLog
+++ b/scripts/ChangeLog
@@ -1,11 +1,16 @@ 2008-08-23 David Bateman <address@hidden
+2008-08-25 David Bateman <address@hidden>
+
+ * plot/__stem__.m: Use property inheritance and don't explicitly
+ call drawnow.
+
2008-08-23 David Bateman <address@hidden>
- * __go_draw_axes__.m: Respect the "visible" property of object and
+ * plot/__go_draw_axes__.m: Respect the "visible" property of object and
don't draw them if the object is not visible.
- * __stem__.m: Convert to use stem series object.
- * stem.m, stem3.m: Update documentation to correpsond to the stem
- series usage.
+ * plot/__stem__.m: Convert to use stem series object.
+ * plot/stem.m, plot/stem3.m: Update documentation to correpsond to
+ the stem series usage.
2008-08-22 John W. Eaton <address@hidden>
diff --git a/scripts/plot/__stem__.m b/scripts/plot/__stem__.m
--- a/scripts/plot/__stem__.m
+++ b/scripts/plot/__stem__.m
@@ -94,8 +94,6 @@ function h = __stem__ (have_z, varargin)
fc, "parent", hg);
if (i == 1)
- ## Must draw the plot first to get proper x limits for the baseline.
- drawnow();
x_axis_range = get (ax, "xlim");
h_baseline = line (x_axis_range, [0, 0], "color", [0, 0, 0]);
set (h_baseline, "handlevisibility", "off");
@@ -115,13 +113,12 @@ function h = __stem__ (have_z, varargin)
addlistener (hg, "basevalue", @move_baseline);
endif
- addproperty ("color", hg, "color", lc);
- addproperty ("linewidth", hg, "double", 0.5);
- addproperty ("linestyle", hg, "radio", "{-}|--|:|-.|none");
- addproperty ("marker", hg, "radio",
- "{none}|s|o|x|+|.|*|<|>|v|^|d|p|h", "o");
- addproperty ("markerfacecolor", hg, "color", fc, "{none}|auto");
- addproperty ("markersize", hg, "double", 6);
+ addproperty ("color", hg, "linecolor", lc);
+ addproperty ("linewidth", hg, "linelinewidth", 0.5);
+ addproperty ("linestyle", hg, "linelinestyle", ls);
+ addproperty ("marker", hg, "linemarker", ms);
+ addproperty ("markerfacecolor", hg, "linemarkerfacecolor", fc);
+ addproperty ("markersize", hg, "linemarkersize", 6);
addlistener (hg, "color", @update_props);
addlistener (hg, "linewidth", @update_props);