setting axis limits weirdness
Ben Abbott
bpabbott at mac.com
Wed Sep 24 05:23:12 CDT 2008
On Sep 24, 2008, at 3:07 AM, Michael Goffioul wrote:
> On Tue, Sep 23, 2008 at 5:37 PM, Ben Abbott
> <benjamin.abbott at tqs.com> wrote:
>> hmmm ...
>>
>> I notice that a subsequent attempt to set the limits does work.
>>
>> x = [-0.1, 1.0];
>> y = [-0.7, 0.7];
>> figure (1, 'visible', 'off');
>> h = plot (x, y);
>> set (gca, 'xlim', x);
>> set (gca, 'ylim', y);
>> set (gca, 'xlim', x);
>> set (gca, 'ylim', y);
>> xlimits = get (gca, 'xlim')
>>
>> Looks like the limmode is switching to manual a bit late.
>
> The problem is that xlimmode is switched to manual
> after calling the updater (update_xlim). This updater is
> responsible for computing the tick marks, but when it
> is called, xlimmode is still auto. I think the fix would be
> to switch xxxmode properties before anything else in
> genprops.awk. This might have other unwanted side effects,
> but the only way to know is to try it.
>
> Ben or John, could you take care of the change (it's only
> moving 2 lines of code in genprops.awk, around line 341)?
>
> Michael.
Michael,
Can you be more specific. Is it as simple as placing "limits[i]" ahead
of "updater[i]"?
324 if (emit_set[i])
325 {
326 printf (" void set_%s (const octave_value& val)", name[i],
type[i]);
327
328 if (emit_set[i] == "definition")
329 {
330 if (updaters[i] || limits[i] || mode[i])
331 has_builtin_listeners = 1;
332 else
333 has_builtin_listeners = 0;
334
335 printf ("\n {\n if (! error_state)\n {\n
if (%s.set (val, %s))\n {\n",
336 name[i], (has_builtin_listeners ? "false" : "true"));
337 if (updater[i])
338 printf (" update_%s ();\n", name[i]);
339 if (limits[i])
340 printf (" update_axis_limits (\"%s\");\n",
name[i]);
341 if (mode[i])
342 printf (" set_%smode (\"manual\");\n",
name[i]);
343 if (has_builtin_listeners)
344 printf (" %s.run_listeners (POSTSET);\n",
name[i]);
345 printf (" mark_modified ();\n");
346 printf (" }\n");
347 if (mode[i])
348 printf (" else\n set_%smode (\"manual\");
\n", name[i]);
349 printf (" }\n }\n\n");
350 }
351 else
352 printf (";\n\n");
353 }
Ben
More information about the Bug-octave
mailing list