bugGNU Octave - Bugs: bug #43705, wrong position of ticks on colormap

 
 

bug #43705: wrong position of ticks on colormap

Submitted by:  None
Submitted on:  Wed 26 Nov 2014 08:05:11 PM UTC  
 
Category: PlottingSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: Wont FixAssigned to: None
Originator Name: Malte HinrichsOriginator Email: -unavailable-
Open/Closed: ClosedRelease: 3.8.0
Operating System: Mac OS

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Tue 02 Jun 2015 11:01:20 PM UTC, comment #5:

This is tricky, but ultimately correct as each function, contourf and colorbar, is doing what it is documented to do. I also don't see that we can change it without introducing an incompatibility with Matlab which will generate further bug reports.

Using the file #32554 that you attached in the following discussion. contourf() colors the entire patch object used to represent a contour based on the Z-level of the lowest point of the contour. In this case the call,

will draw 4 contours and the color will be chosen at Z = 0, 1, 2, 3. When you call contourf() the 'clim' property for the axis gets set to [0, 3]. Any values outside that range are clamped to either the minimum or maximum.

The colorbar() function indicates how data values are mapped to color in the corresponding axis. The colormap you set happens to have entries and is equivalent to "gray(4)". The color axis (caxis() or 'clim' property) runs from 0 to 3 and there are 4 color levels so each break occurs at (3-0)/4 or 0.75. This is indeed what the the colorbar from Matlab and Octave show. Further, the data values do match. The first contour is black, which is the color in the colorbar shown for 0. The second contour is dark grey (z=1), which is the color for any value between 0.75 and 1.5. The third contour is light grey (z=2), which is the color for any value between 1.5 and 2.25. The final contour is white which is the color for any value from 2.25 to Infinity since any value greater than 3 is clamped to 3.

It's perhaps easier to see with this set of commands

which draws contours every 0.5 and shows that each contour is picking up the correct color mapping.

If you are after a particular presentation effect then I would use the longer form of colorbar, 'hc = colorbar', to get a handle to the axes object used to implement the colorbar. Then you can manipulate the properties however you like.

For example,

will produce the picture I think you were hoping for.

Rik <rik5>
Project Administrator
Mon 01 Jun 2015 02:36:04 PM UTC, comment #4:

I tested it. Matlab has the same bug. But I do INSIST that this is a BUG. When you look at the attached graph below for a little longer (file #32554), you will understand why.

For example: When you look at the isoline with value 3 in the graph, you will notice that this value is right between the colors white and light gray. In contrast, when you look at the colorbar to figure out what value the function has at the border between white and light gray you will find a value of 2.25.

Since the function plotted here is z=y, the isoline-value is obviously correct and the other one is wrong.

Hope this helps.

-Malte

Malte Hinrichs <maldje>
Tue 19 May 2015 03:35:42 PM UTC, comment #3:

Can you run the sample code in Matlab and produce a second snaphsot? It's not clear that the colorbar and the contour will look the same if the caxis values are different. Can you also execute caxis() and report what it returns.

Rik <rik5>
Project Administrator
Sun 07 Dec 2014 03:07:52 PM UTC, comment #2:

I am not sure when I will have access to matlab.

However, the result must be that the numbers on the very right (color bar) are identical and at the same y-coordinate as to those on the very left (y-axis).

-Malte

Malte Hinrichs <maldje>
Sat 06 Dec 2014 09:10:13 PM UTC, comment #1:

Do you have access to Matlab and could you run the equivalent code there to produce a second snapshot? I would like to know what the goal should look like.

Rik <rik5>
Project Administrator
Wed 26 Nov 2014 08:05:11 PM UTC, original submission:

Well,

The title says it all. Compare the position of clabels with the colormap ticks and you know what the problem is ;-)

Anonymous

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #32554:  bug_colormap.png added by None (16KiB - image/png)

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 02 Jun 2015 11:01:20 PM UTCrik5StatusNeed Info=>Wont Fix
      Open/ClosedOpen=>Closed
    Sat 06 Dec 2014 03:57:39 PM UTCrik5StatusNone=>Need Info
    Wed 26 Nov 2014 08:05:11 PM UTCNoneAttached File-=>Added bug_colormap.png, #32554

    Back to the top


    Powered by Savane 3.1-cleanup1