bugGNU Octave - Bugs: bug #45594, gnuplot only supports 3-D...


bug #45594: gnuplot only supports 3-D triangular patches

Submitter:  Avinoam Kalma <avinoam>
Submitted:  Tue 21 Jul 2015 08:06:16 AM UTC
Category:  Plotting with gnuplot Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Confirmed Assigned to:  None
Originator Name:  Avinoam Open/Closed:  * Open
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup

Jump to the original submission

Sun 28 Feb 2016 04:00:32 PM UTC, comment #6: 

I added bug #42575 to the dependency list as it would also be solved if gnuplot could create 2-D patches, or if Octave would create 3-D patchs with an empty Z-level.

Rik <rik5>
Group administrator
Sat 19 Dec 2015 02:11:09 AM UTC, comment #5: 

Below is a link describing how 3D polygons may be drawn with gnuplot


Ben Abbott <bpabbott>
Group Member
Thu 17 Dec 2015 11:25:40 PM UTC, comment #4: 


Are general 3D polygons now supported by Gnuplot? I recall trying to fix this some years back and was unable. Can you provide more detail on what gnuplot version is needed and what the syntax is? If you have a gnuplot test script, that would be ideal.

It shouldn't be too much work to create a changeset including patches for _gnuplot_has_feature_ and _go_draw_axes_.


Ben Abbott <bpabbott>
Group Member
Mon 27 Jul 2015 07:03:58 PM UTC, comment #3: 

Some combination of what you describe (I prefer to stay as 2D when possible but realize Octave has a "2D means 3D, but with particular viewing angle" philosophy) and the fact that gnuplot has a polygon object to fall back on should solve this with a fairly small changeset.

I've tested polygon objects in gnuplot.  3D coordinates are allowed.

Dan Sebald <sebald>
Sat 25 Jul 2015 02:39:46 PM UTC, comment #2: 

I've attached the script which causes the error to this bug report.  The Octave file that issues the error is _go_draw_axes_.m.

669                  if (nd == 3)
670                    if (numel (xcol) > 3)
671-->                   error ("__go_draw_axes__: gnuplot (as of v4.2) only supports 3-D filled triangular patches");
672                    else

If this is just an unsupported feature of gnuplot, then this is not an Octave bug.  But it is possible that Octave is not converting things correctly.

In this case, the patch object 'zdata' property is all zeros.  This is correct because they are in fact 2-D patches drawn at Z=0.  However, because the zdata is not empty, the number of dimensions is calculated as 3.  A simple workaround for this particular example is

hp = get (gca, "children")
set (hp, "zdata", [])

The dimension check is done in C++ code in calc_dimensions is graphics.cc

  int nd = 2;

  if (go.isa ("surface"))
    nd = 3;
  else if ((go.isa ("line") || go.isa ("patch"))
           && ! go.get ("zdata").is_empty ())
    nd = 3;

Now maybe the code should check whether all the zdata is 0 before deciding that an object is 3-dimensional, although that is a much more expensive test than just is_empty.

It can also be solved by going back to the original script_patch_problem.m and not specifying zdata of all zeros in the patch.  Then the patch is, correctly, 2-D.

(file #34518)

Rik <rik5>
Group administrator
Tue 21 Jul 2015 08:08:31 AM UTC, comment #1: 

Actually, the word color should be removed from the title

Avinoam Kalma <avinoam>
Group Member
Tue 21 Jul 2015 08:06:16 AM UTC, original submission:  
Avinoam Kalma <avinoam>
Group Member


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

Attach Files:

Attached Files
file #34518:  script_patch_problem.m added by rik5 (908B - text/x-objcsrc)


Depends on the following items: None found

   bug dependencies.


Carbon-Copy List
  • -email is unavailable- added by bpabbott (Posted a comment)
  • -email is unavailable- added by sebald (Posted a comment)
  • -email is unavailable- added by rik5 (Updated the item)
  • -email is unavailable- added by avinoam (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 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-02-29 rik5 StatusNone Confirmed
    2016-02-28 rik5 Dependencies- bugs #42575 is dependent
    2015-07-25 rik5 Attached File- Added script_patch_problem.m, #34518
        SummaryColor problem with patch () using gnuplot as graphics_toolkit gnuplot only supports 3-D triangular patches

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code