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 gnuplotSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Regression
Status: FixedAssigned to: None
Originator Name: Open/Closed: Closed
Release: 4.2.1Operating 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 Jump to the original submission)

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 File(s):

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
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by sebald (Updated the item)
  • -unavailable- added by pot (Submitted the item)

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

    Only project members can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 07 Dec 2017 06:48:39 PM UTCrik5StatusWorks For Me=>Fixed
    Wed 06 Dec 2017 10:15:36 PM UTCrik5StatusNone=>Works For Me
    Wed 06 Dec 2017 08:28:44 PM UTCsebaldAttached File-=>Added octave-gnuplot_tk_truecolor_do_no_scale-djs2017dec06.patch, #42585
    Wed 06 Dec 2017 01:42:45 PM UTCpotAttached File-=>Added legend.png, #42583

    Back to the top

    Powered by Savane 3.1-cleanup1