[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: desired features for gp backend?
From: |
Ben Abbott |
Subject: |
Re: desired features for gp backend? |
Date: |
Fri, 19 Jun 2009 12:51:56 -0400 |
On Friday, June 19, 2009, at 11:59AM, "Rob Mahurin" <address@hidden> wrote:
>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
I like the idea of adding a ticklabelfmt property.
The current default for a linear axis is "%g". For log scale the default should
change to "10^{%T}". A listener should be created for that as well (i.e.
changes to xscale, yscale, zscale will produce a change to xticklabelfmt,
yticklabelfmt, zticklabelfmt strings. To make the user specified ticklabelfmt
stick, perhaps ticklabelfmtmode properties are also needed?
Regarding listeners, there are *many* that need to be written (units conversion
is the best example). I've looked at the code in the hope of finding where such
should be place, but as my c skills are very poor, I've been unable to find
where (or if) such exists in the sources.
Ben