octave-maintainers
[Top][All Lists]
Advanced

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

Re: Improvements in subplot


From: Konstantinos Poulios
Subject: Re: Improvements in subplot
Date: Thu, 10 Mar 2011 20:37:17 +0100

On Sun, Mar 6, 2011 at 8:16 PM, Ben Abbott <address@hidden> wrote:
> On Mar 6, 2011, at 1:27 PM, logari81 wrote:
>
>> On Fri, 2011-03-04 at 21:10 +0000, bpabbott wrote:
>>> On Mar 04, 2011, at 05:57 AM, Konstantinos Poulios
>>> <address@hidden> wrote:
>>>
>>>> Hi all,
>>>>
>>>> I have implemented an idea that I had about subplot. You can try it
>>>> by
>>>> using the attached m-files.
>>>>
>>>> It is not finished yet, so expect some issues (e.g. when subplots do
>>>> not have any titles or axes labels)
>>>>
>>>> However the basic concept, seems to work quite well.
>>>>
>>>> Some points that I could mention:
>>>>
>>>> 1. For both gnuplot and octave if the align_axes option is not
>>>> present, "activepositionproperty" is set to "position". So we
>>>> decline
>>>> from ML, but I think this makes sense because MLs' subplots are not
>>>> perfect either.
>>>>
>>>> 2. Only for fltk, I used listeners in order to notify all subplots
>>>> when tightinset of one of them changes.
>>>>
>>>> 3. Only for fltk, I used the looseinset property in order to align
>>>> axes in column rows and columns. The result is quite neat, see the
>>>> attached png's. This is the reason for using
>>>> "activepositionproperty"="position", otherwise looseinset would have
>>>> no effect.
>>>>
>>>> 4. I have some concerns about the performance since there is a
>>>> significant number of listeners involved. On my pc however it seems
>>>> to
>>>> perform quite well:
>>>> ||octave:40> kostas_subplot_test
>>>> ||1. Drawing a grid of 3x3 plot: 0.09 secs
>>>> ||2. Add some data to the plots: 0.33 secs
>>>> ||3. Add titles: 0.35 secs
>>>> ||4. Add axes labels: 0.79 secs
>>>>
>>>> 5. For the moment this implementation works only for normalized
>>>> units,
>>>> so I have to add some units conversion inside a protected context.
>>>> It
>>>> is in my TODO list.
>>>>
>>>> I would like to have some comments and testing on this solution.
>>>>
>>>> @Ben, could you test the gnuplot part, which I am not very familiar
>>>> with?
>>>>
>>>> Best regards
>>>>
>>>> Kostas
>>>
>>> I ran the subplot demos. Everything there looks ok to me. I'll run all
>>> the demos over the week end and report back on the results.
>>>
>>>
>>> Ben
>>
>> Hi Ben,
>>
>> actually I would like to send you an improved version but there is an
>> issue that I can't solve:
>>
>> I add the listeners for each subplot as I described in my previous mail
>> and everything works fine, until I plot something on the subplot axes.
>> The plot command calls "set_defaults" which in turn removes all
>> listeners.
>>
>> How could I make the listeners persistent? Do you have any clue?
>>
>> BR
>>
>> Kostas
>
> Unfortunately, much of the c++ side remains a mystery for me. Looking at 
> graphics.cc:set_defaults, I don't see where the listeners are being deleted.
>
> I'd expect the listeners to remain in place, unless (1) they are removed by 
> dellistener(), or (2) the axis object is deleted.
>
> If anyone else has some insight into what set_defaults is doing, the script 
> below ....
>
> clf
> axis;
> fun = @() printf ("listener: active property = %s\n", get (gca, 
> "activepositionproperty"));
> addlistener (gca, "activepositionproperty", fun)
> set (gca, "activepositionproperty", "position")
> x = 0:0.1:10;
> plot (x, sin(x));
> get (gca, "activepositionproperty")
> set (gca, "activepositionproperty", "outerposition")
> get (gca, "activepositionproperty")
>
> ... should produce (I think?) ...
>
> listener: active property = position
> ans = position
> listener: active property = outerposition
> ans = outerposition
>
> ... but because the listerner is deleted (accidentally?) when 
> "plot(x,sin(x))" is run, I get ....
>
> listener: active property = position
> ans = position
> ans = outerposition
>
> There no need to apply Kosta's patch to test this behavior.
>
> Ben
>

After having pushed the changes for supporting persistent listeners
you can test the attached subplot version.

Regards

Kostas

Attachment: subplot.m
Description: Text Data

Attachment: __sync_subplots__.m
Description: Text Data


reply via email to

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