bugGNU Octave - Bugs: bug #52599, gnuplot shows shaded images with...


bug #52599: gnuplot shows shaded images with imshow

Submitted by:  Francesco Potortì <pot>
Submitted on:  Wed 06 Dec 2017 01:42:45 PM UTC  
Category:  Plotting with gnuplot Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Regression
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  Closed
Release:  4.2.1 Operating System:  GNU/Linux

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


( Jump to the original submission)

Tue 21 Aug 2018 06:46:53 AM UTC, comment #14:

Done: https://savannah.gnu.org/bugs/index.php?54545

Shane <sffc>
Mon 20 Aug 2018 05:18:14 PM UTC, comment #13:

Shane / Dan - it would be very helpful if you would file a new bug report about this issue instead of continuing to comment on a closed 8-month-old bug report.

Mike Miller <mtmiller>
Project Administrator
Mon 20 Aug 2018 07:28:03 AM UTC, comment #12:

Sure. Here is a session:

Screenshot of the figures: https://snag.gy/ljNxYJ.jpg

The file mandrill.png is a standard sample image from here: http://pngnq.sourceforge.net/pngnqsamples.html

This is with an unpatched Octave built from source on GNU/Linux from the tag "release-4-2-2". All other packages are installed from the system repositories (CentOS 7).

Shane <sffc>
Mon 20 Aug 2018 04:51:18 AM UTC, comment #11:

Can you give an example and some screen shots? Include a screenshot of FLTK result for the same commands if possible, for comparison. For example,

See attached PNG examples, for development version and gnuplot 5.3 patchlevel 0.

The gnuplot change was in version 5.2 (from NEWS):

and it would be a simple matter to put a conditional statement in place to determine if

scaling should be done, but I want to make sure to understand what exactly the scaling problem is.

Dan Sebald <sebald>
Sun 19 Aug 2018 12:52:53 AM UTC, comment #10:


I'm using gnuplot 5.0 and Octave 4.2.2.

imshow was working fine before this change. However, images plotted with imshow or imagesc appear too bright. I've determined that if I reverse the Dan's patch to _gnuplot_draw_axes_.m, images plot correctly.

I have not tested whether this problem still exists in Octave 4.4.

Shane <sffc>
Thu 07 Dec 2017 06:48:39 PM UTC, comment #9:

I pushed Dan's patch here: http://hg.savannah.gnu.org/hgweb/octave/rev/d8626fd6bb36.

Closing this report and #52401.

Rik <rik5>
Project Administrator
Thu 07 Dec 2017 12:11:03 PM UTC, comment #8:

Thank you, your patch fixes my test case.

By the way, any hope of fixing bug #49140 (duplicate of bug #41584)?

Francesco Potortì <pot>
Thu 07 Dec 2017 09:55:43 AM UTC, comment #7:

Yes, let's do that. I built gnuplot 5.0.3 and tested "rundemos draw" with the patch applied and see no differences. So we don't need any type of conditional test on gnuplot version for this change.

Dan Sebald <sebald>
Thu 07 Dec 2017 12:56:27 AM UTC, comment #6:

@Dan: So would you like me to apply your cset from comment #1 and then close this bug and bug #52401?

Rik <rik5>
Project Administrator
Wed 06 Dec 2017 11:05:12 PM UTC, comment #5:

Yeah this could be a case of a change in gnuplot. I'm using the development version 5.3.0.

There is this other bug report from a month or so ago:


at which point I looked into what was going on with gnuplot. gnuplot made a change without too much discussion about syntax. Typically gnuplot is very conservative about changing syntax. Rather than autoscaling to determine range, gnuplot now has this "rgbmax" variable:

If anything, I wish the syntax change would have been "set rgbrange [0:255]" which would have been fully consistent with other range settings in gnuplot.

Nonetheless, gnuplot now has 0 to 255 as the default range and that is probably why this comes up now.

The good thing is that I just went back to the example of https://savannah.gnu.org/bugs/?52401 and changing the color map size to 256

appears to correct the image darkness. So, I'd say if the changeset has no affect on your result with gnuplot 5.0.3 (because that is using autoscaling), then it would be a good fix for the issue without using gnuplot's new "rgbmax" syntax. We could then close this bug report and https://savannah.gnu.org/bugs/?52401

Dan Sebald <sebald>
Wed 06 Dec 2017 10:33:14 PM UTC, comment #4:

Size of colormap is 64x3. I tried changing it with

after the plot had been created but that also didn't affect anything.

This is with gnuplot 5.0.3.

Rik <rik5>
Project Administrator
Wed 06 Dec 2017 10:24:44 PM UTC, comment #3:

Hmm. What are you seeing for the size of your colormap? Is that being set anywhere in your .octaverc?

It's the fact that 64 doesn't file 2^8 that causes the problem.

Dan Sebald <sebald>
Wed 06 Dec 2017 10:15:36 PM UTC, comment #2:

I used

to test, but both images seem the same. This is before applying the patch in comment #1. Is there a different test to try?

Rik <rik5>
Project Administrator
Wed 06 Dec 2017 08:28:44 PM UTC, comment #1:

Try the attached patch.

The image you are seeing is range 0-63 for 8-bit image, which naturally comes out darker. I can't recall why I would have scaled the true-color data to the range of the color map for Truecolor data. gnuplot does have a means of generating images through a color map (and I'm sure that's what was on my mind at the time), but that's not pertinent to 3-component data. In any case, I don't see any adverse effects in "rundemos draw" with the attached patch.

(file #42585)

Dan Sebald <sebald>
Wed 06 Dec 2017 01:42:45 PM UTC, original submission:

After applying the patch for bug #52589 (have not tried without the patch) gnuplot shows a shaded image when using imshow on a png image containing only primary saturated colours.

THe following works well with the attached file

If you try using gnuplot rather than fltk, you see a shaded image.

By the way, note that I force the output of imread to double because of bug #49140.

Francesco Potortì <pot>


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

Attach Files:

Attached Files
file #42583:  legend.png added by pot (1KiB - image/png - contains only primary saturated colours)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by sffc (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by sebald (Updated the item)
  • -email is unavailable- added by pot (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.




    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-08-20 mtmiller Carbon-CopyRemoved 80942 => -
    2017-12-07 rik5 StatusWorks For Me => Fixed
        Open/ClosedOpen => Closed
    2017-12-06 rik5 StatusNone => Works For Me
    2017-12-06 sebald Attached File- => Added octave-gnuplot_tk_truecolor_do_no_scale-djs2017dec06.patch, #42585
    2017-12-06 pot Attached File- => Added legend.png, #42583

    Back to the top

    Powered by Savane 3.3