octave-maintainers
[Top][All Lists]
Advanced

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

Re: AspectRatio Patches [changeset]


From: Ben Abbott
Subject: Re: AspectRatio Patches [changeset]
Date: Tue, 02 Nov 2010 19:13:11 -0400

On Nov 2, 2010, at 1:45 PM, logari81 wrote:

> On Mon, 2010-11-01 at 23:06 -0400, Ben Abbott wrote:
>> On Nov 1, 2010, at 5:54 PM, logari81 wrote:
>> 
>>> On Mon, 2010-11-01 at 05:53 -0400, Ben Abbott wrote:
>>>> On Nov 1, 2010, at 3:54 AM, Konstantinos Poulios wrote:
>>>> 
>>>>> On Mon, Nov 1, 2010 at 4:26 AM, Ben Abbott <address@hidden> wrote:
>>>>>> 
>>> ...
>>>>>> 
>>>>>> I was unable to apply your patch.
>>>>>> 
>>>>>> $ patch -p1 < /Users/bpabbott/Desktop/octave_aspectratios_2.patch
>>>>>> patching file src/graphics.cc
>>>>>> Hunk #2 FAILED at 3911.
>>>>>> Hunk #3 FAILED at 3927.
>>>>>> Hunk #4 FAILED at 4575.
>>>>>> 3 out of 4 hunks FAILED -- saving rejects to file src/graphics.cc.rej
>>>>>> 
>>>>>> Can you generate a mercurial changeset against the current sources?
>>>>>> 
>>>>>> Ben
>>>>> 
>>>>> Ups, sorry for the inconvenience. This was of course the wrong file. I
>>>>> send you the right one in the present mail.
>>>>> 
>>>>> Kostas
>>>>> <aspectratios2.changeset>
>>>> 
>>>> With this changeset, I'm not getting the correct result for "axis equal". 
>>>> See the LL plot for ...
>>>> 
>>>>    demo ("axis", 1)
>>>> 
>>>> Also, the 5th demo gives me an error.
>>>> 
>>>>    demo ("axis", 1)
>>>> 
>>>> axis example 5:
>>>> clf
>>>> axis image
>>>> x=0:0.1:10;
>>>> plot(x,sin(x))
>>>> axis image
>>>> title("image")
>>>> 
>>>> error: __actual_axis_position__: quotient: nonconformant arguments (op1 is 
>>>> 1x2, op2 is 1x3)
>>>> error: called from:
>>>> error:   
>>>> /Users/bpabbott/Development/mercurial/local_clone/scripts/plot/private/__actual_axis_position__.m
>>>>  at line 65, column 33
>>>> error:   
>>>> /Users/bpabbott/Development/mercurial/local_clone/scripts/plot/__go_draw_axes__.m
>>>>  at line 71, column 9
>>>> error:   
>>>> /Users/bpabbott/Development/mercurial/local_clone/scripts/plot/__go_draw_figure__.m
>>>>  at line 86, column 17
>>>> error:   
>>>> /Users/bpabbott/Development/mercurial/local_clone/scripts/plot/gnuplot_drawnow.m
>>>>  at line 90, column 5
>>>> error: input: reading user-input failed!
>>>> error:   
>>>> /Users/bpabbott/Development/mercurial/local_clone/scripts/testfun/demo.m 
>>>> at line 110, column 7
>>>> 
>>>> Ben
>>>> 
>>>> p.s. we dropped off the list, so I've reattached you changeset, in case 
>>>> others want to take a look.
>>>> 
>>> 
>>> Hi Ben.
>>> 
>>> Concerning the error in __actual_axis_position__ it seems that an older
>>> bug has been triggered through my changes. Anyway the part of the code
>>> where the error occurs seems to be redundant as it tries to recalculate
>>> the plotboxaspectratio that we have already calculated in graphics.cc .
>>> So I believe this calculation should be better removed instead of been
>>> fixed. The changeset in the file "aspectratios3.changeset" removes this
>>> redundant code.
>>> 
>>> After this, the changeset "aspectratios4.changeset" which is an updated
>>> version of "aspectratios2.changeset" can be applied as well.
>>> 
>>> On my system with this two changesets (3 and 4) applied all axis demos
>>> worked well with the gnuplot backend.
>>> 
>>> For demo("axis",1) I couldn't notice any unexpected behavior. Could you
>>> test these two patches and attach some screenshot if you find any error?
>>> 
>>> Thank you in advance
>>> 
>>> Kostas
>>> <aspectratios3.changeset><aspectratios4.changeset>
>> 
>> Both demo 1 and 5 still have problems with axis("equal"). This command 
>> should produce an equal number of pixels per data unit for the x/y/z axes.
>> 
>> I've attached pdfs illustrating what I see for Matlab and for Octave (the 
>> gnuplot backend). Using the FLTK backend, I get the correct result for the 
>> first demo, but the 5th one gives a blank figure window.
>> 
>> Ben
>> 
> 
> Hi Ben,
> 
> I cannot reproduce the problems shown in your pdfs. For me with
> "aspectratios3.changeset" and "aspectratios4.changeset" applied the
> demos 1 and 5 give the results shown in the attached files.
> 
> Demo 5 doesn't work with the fltk backend, but it didn't work before my
> changes (11159) neither. I will try to fix this problem later but
> actually it shouldn't be related to these patches.
> 
> The only difference in 223 subplot of demo1 between matlab and my
> current patched version is ylim. But this is another old problem.
> Actually comparing 11159 with my current version with respect to demos 1
> and 5 there are no differences at all.
> 
> Could you compare a clean build of 11159 with a clean build of 11167
> +aspectratios3.changeset+aspectratio4.changeset ? In case that you can
> confirm that the all demos behave the same, I would propose that you
> apply the last two patches and wait for my fixes for the rest of the
> issues.
> 
> Best regards,
> 
> Kostas

I'm using gnuplot v 4.4.

I suspect you're using 4.2 or earlier. The code below (85-122) is responsible 
for the difference in behavior.

  85     if (strcmp (axis_obj.activepositionproperty, "position"))
  86       if (__gnuplot_has_feature__ ("screen_coordinates_for_{lrtb}margin"))
  87         if (nd == 2 || all (mod (axis_obj.view, 90) == 0))
  88           x = [1, 1];
  89         else
  90           ## 3D plots need to be sized down to fit in the window.
  91           x = 1.0 ./ sqrt([2, 2.5]);
  92         endif
  93         fprintf (plot_stream, "set tmargin screen %.15g;\n",
  94                  pos(2)+pos(4)/2+x(2)*pos(4)/2);
  95         fprintf (plot_stream, "set bmargin screen %.15g;\n",
  96                  pos(2)+pos(4)/2-x(2)*pos(4)/2);
  97         fprintf (plot_stream, "set lmargin screen %.15g;\n",
  98                  pos(1)+pos(3)/2-x(1)*pos(3)/2);
  99         fprintf (plot_stream, "set rmargin screen %.15g;\n",
 100                  pos(1)+pos(3)/2+x(1)*pos(3)/2);
 101         sz_str = "";
 102       else
 103         fprintf (plot_stream, "set tmargin 0;\n");
 104         fprintf (plot_stream, "set bmargin 0;\n");
 105         fprintf (plot_stream, "set lmargin 0;\n");
 106         fprintf (plot_stream, "set rmargin 0;\n");
 107 
 108         if (nd == 3 && all (axis_obj.view == [0, 90]))
 109           ## FIXME -- Kludge to allow colorbar to be added to a pcolor() 
plot
 110           pos(3:4) = pos(3:4) * 1.4;
 111           pos(1:2) = pos(1:2) - pos(3:4) * 0.125;
 112         endif
 113 
 114         fprintf (plot_stream, "set origin %.15g, %.15g;\n", pos(1), 
pos(2));
 115 
 116         if (strcmpi (axis_obj.dataaspectratiomode, "manual"))
 117           sz_str = sprintf ("set size ratio %.15g", -dr);
 118         else
 119           sz_str = "set size noratio";
 120         endif
 121         sz_str = sprintf ("%s %.15g, %.15g;\n", sz_str, pos(3), pos(4));
 122       endif
 123     else ## activepositionproperty == outerposition
 124       fprintf (plot_stream, "set origin %g, %g;\n", pos(1:2))
 125       sz_str = "";
 126       if (strcmpi (axis_obj.dataaspectratiomode, "manual"))
 127         sz_str = sprintf ("ratio %g", -dr);
 128       else
 129         sz_str = "noratio";
 130       endif
 131       sz_str = sprintf ("set size %s %g, %g;\n", sz_str, pos(3:4));
 132     endif

Ben



reply via email to

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