bugGNU Octave - Bugs: bug #40686, Incorrect colorbar size after...


bug #40686: Incorrect colorbar size after "axis tight" or "axis equal"

Submitted by:  Ben Abbott <bpabbott>
Submitted on:  Sun 24 Nov 2013 02:03:26 AM UTC  
Category: PlottingSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: ConfirmedAssigned to: None
Originator Name: Ben AbbottOpen/Closed: Open
Release: devOperating System: Any

Add a New Comment(Rich Markup)

You are not logged in

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


Thu 24 Nov 2016 10:17:54 PM UTC, comment #4:

I think the problem is either one of 'axis square' or 'axis equal' which affect change dataaspectratio and plotboxaspectratio.

Rik <rik5>
Project Administrator
Wed 23 Nov 2016 10:25:09 PM UTC, comment #3:

This issue might be FIXED in Octave 4.2.0.

When running the script from comment #0 in Octave 4.2.0, then I now get visually "too long" colorbars. But they go over the full height of the figure window, so probably that is "right height" and this last remaining issue is fixed, now. But I am not 100% sure how the "perfect plot result" should look like in this case.

Hartmut <hardy>
Wed 20 May 2015 03:30:16 PM UTC, comment #2:

Item (1) is caused by the fact that surf produces 3-D output, but the command "view (0, 90)" is restricting it to 2-D. For 2-D plots there is no need to take into account the Z-axis and that is why Octave doesn't bother to set the Z limits correctly.

This is a known issue and both Matlab and Octave have the pcolor() function for producing this sort of plot. Replacing

correctly sets the zlim values.

Item (3), the size of the colorbar, still remains. Re-titling the bug report to emphasize that issue.

Since colorbars, legends, and text objects are annotations. It makes sense to add these only after the plot is visually the way you like it. I know Octave should be able to handle the other ordering through callbacks, but at least for now there is a simple work around which is to have colorbar be the last command for a plot.

Rik <rik5>
Project Administrator
Mon 09 Feb 2015 11:04:19 PM UTC, comment #1:


After this changeset http://hg.savannah.gnu.org/hgweb/octave/rev/8064b5cdbc11 , axes sizes are consistent. Item (1) and (3) still remain.

Pantxo Diribarne <pantxo>
Project Member
Sun 24 Nov 2013 02:03:26 AM UTC, original submission:

The demo below exhibits three problems

(1) The zlim() is not set correctly (the peaks are truncated)
(2) The axes plot boxes are not consistent in size
(3) The colorbar heights are short.

These problems only exist with "axes square; axes equal".

The resulting positions are below.

Ben Abbott <bpabbott>
Project Member


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

Attach File(s):

Attached Files
file #29695:  figure.png added by bpabbott (86KiB - image/png)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by hardy (Posted a comment)
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by pantxo (Posted a comment)
  • -unavailable- added by bpabbott (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
    Thu 24 Nov 2016 10:17:54 PM UTCrik5SummaryIncorrect colorbar size after "axis tight"=>Incorrect colorbar size after "axis tight" or "axis equal"
    Wed 20 May 2015 03:30:16 PM UTCrik5StatusNone=>Confirmed
      Summarytrouble with subplots and colorbar=>Incorrect colorbar size after "axis tight"
    Sun 24 Nov 2013 02:03:26 AM UTCbpabbottAttached File-=>Added figure.png, #29695

    Back to the top

    Powered by Savane 3.1-cleanup1