bugGNU Octave - Bugs: bug #43447, trisurf produces misplaced...

 
 

bug #43447: trisurf produces misplaced vertical line

Submitter:  None
Submitted:  Mon 20 Oct 2014 06:15:55 PM UTC
   
 
Category:  Plotting with gnuplot Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Sigurd Angenent Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 3.8.1
Operating System:  * Mac OS Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Fri 26 Dec 2014 03:33:13 AM UTC, comment #14: 

I still think the line connecting the outer edge of the surface to the x-y plane is unnecessary, but this is clearly a gnuplot decision rather than anything Octave is feeding it.

The coloring for patches doesn't seem to be correct.  Even when commenting out the lines you suggest I don't get entirely the correct results.  Worse, with those lines commented out I get very bad results for other sorts of color displays.


image (1:8, linspace (0, 1, 8), repmat ((1:8)', 1, 8));
colormap (jet (8));


I'm going to close this report and open a new one which is specifically about patch coloring.

Rik <rik5>
Group administrator
Tue 23 Dec 2014 09:23:21 PM UTC, comment #13: 

Hi,

the coloring difference is becuase of colormap change
(lines 1633-174) in _go_draw_axes_.m

 if (length (cmap) > 0)
    fprintf (plot_stream,
             "set palette positive color model RGB maxcolors %i;\n",
             cmap_sz);
    fprintf (plot_stream,
             "set palette file \"-\" binary record=%d using 1:2:3:4;\n",
             cmap_sz);
    fwrite (plot_stream, [1:cmap_sz; cmap.'], "float32");
    fwrite (plot_stream, "\n");
  endif

if you comment them out, you will get the same coloring as in fltk.

The misplaced vertical line is actually not misplaced, but a
vertical line gnuplot add in 3D image. For examples:

f = @(x,y) exp(-x.*x-y.*y);
ezmesh (f, [-1, 1]);

gnuplot draws the frontal horizontal line, from
(-1,-1,0) to (-1,-1,exp(-0.02)).
with fltk you will not see this line.

Avinoam

Avinoam Kalma <avinoam>
Group Member
Mon 22 Dec 2014 03:53:56 AM UTC, comment #12: 

I applied the patch for trisurf here (http://hg.savannah.gnu.org/hgweb/octave/rev/c029983a0389).  I've re-titled the bug report to reflect the remaining issue.

Rik <rik5>
Group administrator
Mon 15 Dec 2014 06:57:44 PM UTC, comment #11: 

The misplaced line, and the incorrect coloring, are both outstanding issues.

Rik <rik5>
Group administrator
Mon 15 Dec 2014 06:05:44 PM UTC, comment #10: 

Hi Rik,

thanks, I prefer to remain anonymous.
But, please do not close this bug,
because I am stil truing to debug the misplaced line.

Avinoam

Avinoam Kalma <avinoam>
Group Member
Mon 15 Dec 2014 04:06:06 PM UTC, comment #9: 

@Avinoam: I am going to apply your patch for trisurf.  Traditionally we credit the contributor with "firstname lastname <e-mail address>" in the commit log.  Is this good for you, or do you prefer to remain anonymous?

Rik <rik5>
Group administrator
Sun 07 Dec 2014 12:26:04 AM UTC, comment #8: 

I applied the patch and I no longer get the error messages.  However, the resulting plots are colored quite differently between FLTK and gnuplot.  Is this a different error being exposed or is the fix here not quite right for the color data?  See the attached files.


Rik <rik5>
Group administrator
Mon 24 Nov 2014 08:15:16 PM UTC, comment #7: 


Hi,

I have uploaded a patch for this bug.
I do not know if it's the best way to fix the bug, or if
this patch don't cause other problems.
After applying this patch, gnuplot results are almost the
same as fltk results (except from one misplaced line in gnuplot
graph).

Please check this.

Thanks,

Avinoam

(file #32536)

Avinoam Kalma <avinoam>
Group Member
Tue 21 Oct 2014 10:35:25 PM UTC, comment #6: 

Confirmed.  The bug is still present on the development branch as well (10/21/14).  There are many reasons why Octave developers are trying to move away from gnuplot to an OpenGL based plotting engine and this just adds one more.

Rik <rik5>
Group administrator
Tue 21 Oct 2014 02:26:32 PM UTC, comment #5: 

Here is the content of the file tetra.m

             -1 -1  1;
              1 -1 -1;
             -1  1 -1]
triangles = [ 1 2 3;
              2 1 4;
              3 2 4;
              4 1 3]

X = vertices(:, 1);
Y = vertices(:, 2);
Z = vertices(:, 3);

trisurf(triangles, X, Y, Z);


Here is the Octave output :

octave:1> tetra
vertices =

   1   1   1
  -1  -1   1
   1  -1  -1
  -1   1  -1

triangles =

   1   2   3
   2   1   4
   3   2   4
   4   1   3

error: horizontal dimensions mismatch (4x3 vs 2x1)
error: called from:
error:   /usr/local/Cellar/octave/3.8.1/share/octave/3.8.1/m/plot/util/private/__go_draw_axes__.m at line 760, column 33
error:   /usr/local/Cellar/octave/3.8.1/share/octave/3.8.1/m/plot/util/private/__go_draw_figure__.m at line 172, column 17
error:   /usr/local/Cellar/octave/3.8.1/share/octave/3.8.1/m/plot/util/__gnuplot_drawnow__.m at line 86, column 5
octave:2>


Sigurd Angenent <sigurda>
Tue 21 Oct 2014 02:23:40 PM UTC, comment #4: 

Here is the Octave output :

octave:1> tetra
vertices =

   1   1   1
  -1  -1   1
   1  -1  -1
  -1   1  -1

triangles =

   1   2   3
   2   1   4
   3   2   4
   4   1   3

error: horizontal dimensions mismatch (4x3 vs 2x1)
error: called from:
error:   /usr/local/Cellar/octave/3.8.1/share/octave/3.8.1/m/plot/util/private/__go_draw_axes__.m at line 760, column 33
error:   /usr/local/Cellar/octave/3.8.1/share/octave/3.8.1/m/plot/util/private/__go_draw_figure__.m at line 172, column 17
error:   /usr/local/Cellar/octave/3.8.1/share/octave/3.8.1/m/plot/util/__gnuplot_drawnow__.m at line 86, column 5
octave:2>
+verbatim+

Sigurd Angenent <sigurda>
Tue 21 Oct 2014 07:27:56 AM UTC, comment #3: 

Hm, this is strange...


vertices = [  1  1  1;
             -1 -1  1;
              1 -1 -1;
             -1  1 -1]
triangles = [ 1 2 3;
              2 1 4;
              3 2 4;
              4 1 3]

X = vertices(:, 1);
Y = vertices(:, 2);
Z = vertices(:, 3);

trisurf(triangles, X, Y, Z);

error: horizontal dimensions mismatch (4x3 vs 2x1)
error: called from:
error:   /usr/local/share/octave/3.8.2/m/plot/util/private/__go_draw_axes__.m
at line 760, column 33
error:
/usr/local/share/octave/3.8.2/m/plot/util/private/__go_draw_figure__.m at line
172, column 17
error:   /usr/local/share/octave/3.8.2/m/plot/util/__gnuplot_drawnow__.m at
line 86, column 5

(after closing verbatim block)

Andreas Weber <andy1978>
Group Member
Tue 21 Oct 2014 07:26:28 AM UTC, comment #2: 

@Sigurd: You should use verbatim blocks to guard the code. I repost it for you. I also can confirm that the error below is raised in Octave 3.8.2 only with graphics_toolkit gnuplot. FLTK works as expected.


vertices = [  1  1  1;
             -1 -1  1;
              1 -1 -1;
             -1  1 -1]
triangles = [ 1 2 3;
              2 1 4;
              3 2 4;
              4 1 3]

X = vertices(:, 1);
Y = vertices(:, 2);
Z = vertices(:, 3);

trisurf(triangles, X, Y, Z);

error: horizontal dimensions mismatch (4x3 vs 2x1)
error: called from:
error:   /usr/local/share/octave/3.8.2/m/plot/util/private/__go_draw_axes__.m at line 760, column 33
error:   /usr/local/share/octave/3.8.2/m/plot/util/private/__go_draw_figure__.m at line 172, column 17
error:   /usr/local/share/octave/3.8.2/m/plot/util/__gnuplot_drawnow__.m at line 86, column 5
-verbatim

Andreas Weber <andy1978>
Group Member
Tue 21 Oct 2014 07:20:57 AM UTC, comment #1: 

Hi,

Thanks for your bug report. There must have been a problem with verbatim markup. Can you repost your example, and the error message you get?

Pantxo Diribarne <pantxo>
Group Member
Mon 20 Oct 2014 06:15:55 PM UTC, original submission:  

I tried demo("trisurf",1) and this works

The following script which I wrote produces an error message.  I don't think it should...

vertices = [  1  1  1;
             -1 -1  1;
              1 -1 -1;
             -1  1 -1]
triangles = [ 1 2 3;
              2 1 4;
              3 2 4;
              4 1 3]

X = vertices(:, 1);
Y = vertices(:, 2);
Z = vertices(:, 3);

trisurf(triangles, X, Y, Z);
+verbatim+
Here's the error message
+verbatim+
GNU Octave, version 3.8.1
Copyright (C) 2014 John W. Eaton and others.
This is free software; see the source code for copying conditions.
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  For details, type 'warranty'.

Octave was configured for "x86_64-apple-darwin13.4.0".

Additional information about Octave is available at http://www.octave.org.

Please contribute if you find this software useful.
For more information, visit http://www.octave.org/get-involved.html

Read http://www.octave.org/bugs.html to learn how to submit bug reports.
For information about changes from previous versions, type 'news'.

octave:1> tetra
vertices =

   1   1   1
  -1  -1   1
   1  -1  -1
  -1   1  -1

triangles =

   1   2   3
   2   1   4
   3   2   4
   4   1   3

error: horizontal dimensions mismatch (4x3 vs 2x1)
error: called from:
error:   /usr/local/Cellar/octave/3.8.1/share/octave/3.8.1/m/plot/util/private/__go_draw_axes__.m at line 760, column 33
error:   /usr/local/Cellar/octave/3.8.1/share/octave/3.8.1/m/plot/util/private/__go_draw_figure__.m at line 172, column 17
error:   /usr/local/Cellar/octave/3.8.1/share/octave/3.8.1/m/plot/util/__gnuplot_drawnow__.m at line 86, column 5
octave:2>
+verbatim+

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #32613:  fltk.png added by rik5 (64KiB - image/png)
file #32614:  gnuplot.png added by rik5 (53KiB - image/png)
file #32536:  trisurf.patch added by avinoam (760B - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by avinoam (Updated the item)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by sigurda (Posted a comment)
  • -email is unavailable- added by andy1978 (Posted a comment)
  • -email is unavailable- added by pantxo (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-12-26 rik5 StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2014-12-22 rik5 Summarytrisurf produces error message trisurf produces misplaced vertical line
    2014-12-07 rik5 Attached File- Added fltk.png, #32613
        Attached File- Added gnuplot.png, #32614
    2014-11-24 avinoam Attached File- Added trisurf.patch, #32536
    2014-10-21 rik5 StatusNone Confirmed

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code