bugGNU Octave - Bugs: bug #54545, Images plotted with imshow are too...


bug #54545: Images plotted with imshow are too bright with Gnuplot 5.0 and earlier

Submitted by:  Shane <sffc>
Submitted on:  Tue 21 Aug 2018 06:46:24 AM UTC  
Category:  Plotting with gnuplot Severity:  3 - Normal
Priority:  3 - Low Item Group:  Regression
Status:  Confirmed Assigned to:  None
Originator Name:  Open/Closed:  Open
Release:  dev 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.


Thu 20 Sep 2018 05:02:27 PM UTC, comment #1:

Confirmed with Octave 4.4 and the development version, using gnuplot 4.6.

Also confirmed that https://hg.savannah.gnu.org/hgweb/octave/rev/d8626fd6bb36 is responsible for this regression with older gnuplot, and that restoring the line

--- a/scripts/plot/util/private/__gnuplot_draw_axes__.m
+++ b/scripts/plot/util/private/__gnuplot_draw_axes__.m
@@ -2847,6 +2847,8 @@ function cdata = mapcdata (cdata, mode,
       cdata(:) = fix (255 / 2);
+    ## Scale using inverse of gnuplot's cbrange mapping
+    cdata = 1 + cdata * (cmap_sz-1)/255;
     if (strcmp (mode, "scaled"))
       clim = double (clim);

restores the previous behavior, obviously while breaking gnuplot 5.2 and newer.

Mike Miller <mtmiller>
Project Administrator
Tue 21 Aug 2018 06:46:24 AM UTC, original submission:

Originally reported here: https://savannah.gnu.org/bugs/?52599#comment10

I'm using gnuplot 5.0 and Octave 4.2.2.

imshow was working fine with gnuplot in Octave 4.2.1. However, in Octave 4.2.2, images plotted with imshow or imagesc appear too bright (in fact, 4x too bright). I've determined that if I reverse patch posted by Dan on #52599, images one again plot correctly.

#52599 was to make Octave work with gnuplot 5.2 and higher. However, gnuplot versions prior to 5.2 are still widely found in the wild, even on up-to-date distributions. Version 5.2 made it into Ubuntu 18.04 LTS, but the latest Debian and Fedora are on 5.0, and the latest CentOS is on 4.6.

Here is a session:

$ gnuplot --version
gnuplot 5.0 patchlevel 2
$ ./run-octave --no-gui
GNU Octave, version 4.2.2
octave:1> graphics_toolkit fltk; figure(); imshow(imread("~/mandrill.png"));
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast
octave:2> graphics_toolkit gnuplot; figure(); imshow(imread("~/mandrill.png"));

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". Most other packages are installed from the system repositories (CentOS 7).

I have not tested whether this problem still exists in Octave 4.4, but it likely does since I believe Dan's patch is still present in 4.4.

Shane <sffc>


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

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by sffc
  • -email is unavailable- added by sffc (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-09-20 mtmiller Carbon-CopyRemoved mtmiller => -
    2018-09-20 mtmiller Priority5 - Normal => 3 - Low
        StatusNone => Confirmed
        Release4.2.2 => dev
    2018-08-21 sffc Carbon-Copy- => Added sebald
        Carbon-Copy- => Added mtmiller

    Back to the top

    Powered by Savane 3.4