octave-maintainers
[Top][All Lists]
Advanced

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

Re: desired features for gp backend?


From: Rob Mahurin
Subject: Re: desired features for gp backend?
Date: Fri, 19 Jun 2009 11:59:22 -0400

On Jun 18, 2009, at 6:35 PM, Ben Abbott wrote:
Regarding the old thread, I noticed the suggestion to allow the ticklabels to be formated as ...

        set (gca, "xticklabel", "%.2f")

This can be done as a one-liner ...

        set (gca, "xticklabel", sprintf("%.2f|", get (gca, "xtick")))

However, I think it more convenient to support having the ticklabels specified as format statements. If the y-axes units were dollars ...

        set (gca, "yticklabel", "$%.2f")

If the units were um

        set (gca, "yticklabel", "%.2fum")

I think this was rejected in the past because it's incompatible with Matlab. This works without introducing incompatibilities:

function update_ticklabels(handle,dummy,axis);
        fmt = get(handle, [axis, "ticklabelfmt"]);
        labels = sprintf([fmt, "|"], get(handle, [axis, "tick"]) );
        set(handle,[axis, "ticklabel"], labels);
endfunction
addproperty("xticklabelfmt",gca,"string","%g");
addlistener(gca, "xticklabelfmt", address@hidden, "x"})
set(gca,"xticklabelfmt","%#.2g")
set(gca,"xticklabelfmt","%.1f")

That's typed in the terminal, of course. I see default properties in src/graphics.h.in, but where would I add a default listener?

Cheers,
Rob

--
Rob Mahurin
University of Manitoba, Dept. of Physics & Astronomy
at:     Oak Ridge National Laboratory   865 207 2594
        Oak Ridge, Tennessee            address@hidden






reply via email to

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