bugGNU Octave - Bugs: bug #38666, gnuplot and imagesc prints garbled...


bug #38666: gnuplot and imagesc prints garbled image for certain matrix sizes for sufficently large colormap size

Submitter:  None
Submitted:  Fri 05 Apr 2013 04:56:49 PM UTC
Category:  Plotting with gnuplot Severity:  3 - Normal
Priority:  3 - Low Item Group:  Incorrect Result
Status:  Wont Fix Assigned to:  None
Originator Name:  John Schneeloch Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * dev
Operating System:  * Any Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup

Jump to the original submission

Wed 19 Apr 2023 02:25:58 AM UTC, comment #6: 

updating for octave 8.2.0:

this behavior still exists, but only for gnuplot.

As this report has been dormant for some time, only exists in gnuplot, and the developers have decided that the gnuplot toolkit will no longer be actively maintained (and now issue a warning on use to emphasize that fact), I'm marking this bug as won't fix and closing report.  If someone wants to dive into gnuplot and try to fix it, it can be reopened.

Nicholas Jankowski <nrjank>
Group Member
Wed 16 Nov 2016 07:50:58 PM UTC, comment #5: 

I'm not sure there is any good solution, other than jettisoning gnuplot.

When the size of the data transferred is larger than the max size of the SW pipe used for communication between Octave and gnuplot then there are problems.  See /proc/sys/fs/pipe-max-size for the maximum size in the current kernel.  At least in Linux, a particular pipe can be resized, on the fly, with

fcntl(fd, F_SETPIPE_SZ, size)

as long as the size does not exceed pipe-max-size.

I suppose there might be a way to recode _gnuplot_draw_now_ to send data over in chunks.  But will gnuplot on the other side understand when it has only received partial input and needs to wait?

Rik <rik5>
Group administrator
Wed 16 Nov 2016 07:40:10 PM UTC, comment #4: 

Still confirmed with the development version of Octave (4.3.0+) and gnuplot 5.

Mike Miller <mtmiller>
Group Member
Sun 07 Apr 2013 06:22:16 PM UTC, comment #3: 

The result is confirmed.  It is definitely a problem with the interaction with gnuplot--the FLTK backend seems to work just fine.  I tried Octave versions 3.6.4 and a recent development tip as well as gnuplot versions 4.4.3 and 4.6.2.

Rik <rik5>
Group administrator
Sun 07 Apr 2013 05:10:01 AM UTC, comment #2: 

I've attached garbled and non-garbled versions of the plot for nsize = 99 and ncolors = 257 for the garbled version, ncolors=256 for the non-garbled one. (I think I reported the direction of the gradient in the wrong direction, by the way.) According to the graphics_toolkit command, I'm using gnuplot.

Sat 06 Apr 2013 12:02:12 AM UTC, comment #1: 

Can you upload the generated png file that is in error so we can take a look at it.  Also, are you using gnuplot or FLTK for plotting?  That also makes a big difference.

Rik <rik5>
Group administrator
Fri 05 Apr 2013 04:56:49 PM UTC, original submission:  

While making plots using imagesc, I ran into this weird bug. Sometimes the image displays fine in AquaTerm but the plot saved with the "print" command produces a garbled output. Below is the simplest example I could come up with, which displays a rainbow gradient (red in the lower right corner to blue in the upper left), but when saved produces a png file with red horizontal bands crossing the image, blue speckles, and pieces of the image displaying in the wrong locations. As far as I can tell, the result is garbled only for ncolors (the number of colors in the colormap) greater than 256, and only for certain nsize values (e.g., 103 is bad, 100-102 are fine, 99 is bad, etc.)

# generate image data
nsize = 103;
x = 1:nsize;
y = 1:nsize;
z = x'*x + y'*y;

ncolors = 257;
cmap = jet(ncolors);

print('./test1.png', '-dpng')



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

Attach Files:

Attached Files
file #27799:  garbled.png added by None (17KiB - image/png)
file #27800:  notgarbled.png added by None (21KiB - image/png)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by nrjank (Posted a comment)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by rik5
  • -email is unavailable- added by rik5 (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 12 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-04-19 nrjank StatusConfirmed Wont Fix
        Open/ClosedOpen Closed
    2016-11-16 mtmiller Priority5 - Normal 3 - Low
        Release3.6.4 dev
        Summaryimagesc prints garbled image for certain matrix sizes for sufficently large colormap size gnuplot and imagesc prints garbled image for certain matrix sizes for sufficently large colormap size
    2013-04-07 rik5 CategoryPlotting Plotting with gnuplot
        StatusNeed Info Confirmed
        Operating SystemMac OS Any
        Carbon-Copy- Added -email is unavailable-
    2013-04-07 None Attached File- Added garbled.png, #27799
        Attached File- Added notgarbled.png, #27800
    2013-04-06 rik5 StatusNone Need Info

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code