bugGNU Octave - Bugs: bug #60236, figure is cropped without warning...


bug #60236: figure is cropped without warning when printing a large figure to pdf or ps

Submitted by:  Markus Mützel <mmuetzel>
Submitted on:  Mon 15 Mar 2021 10:58:08 AM UTC  
Category:  Plotting with OpenGL Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Missed Error or Warning
Status:  Fixed Assigned to:  None
Originator Name:  rik5 Open/Closed:  Closed
Release:  6.2.0 Operating System:  Any

Add a New Comment (Rich Markup)

You are not logged in

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


Sat 20 Mar 2021 01:29:27 PM UTC, comment #3: 

Seems to display the warning when the figure is too large for the output page. Tested with Octave stable (hg id 75ba68c686ab) on Ubuntu 20.10.

Closing as fixed.

Markus Mützel <mmuetzel>
Project Member
Mon 15 Mar 2021 05:57:59 PM UTC, comment #2: 

Thanks for the patch. It looks good to me.

Since this is a change in behavior compared to Octave 5 and the patch is not very intrusive with a low risk of breaking something (I hope), I pushed it to stable here:

Marking as ready for test.

Markus Mützel <mmuetzel>
Project Member
Mon 15 Mar 2021 12:51:38 PM UTC, comment #1: 

The attached patch should do the trick. Don't hesitate to reword/augment the warning message.

I changed the Item Group to "Missed error or warning" since this is not really a regression. Prior to Octave 6, the default "paperposition" used to fit in the default "papersize" but changing one of those already could lead to the same cropped figure without warning.

(file #51067)

Pantxo Diribarne <pantxo>
Project Member
Mon 15 Mar 2021 10:58:08 AM UTC, original submission:  

As noticed in bug #33118, the axes in the resulting file can exceed the page size if a very large figure is printed to a .pdf or .ps file.

Steps to reproduce:

hf = figure(1);
% resize the figure on screen
print(hf, '-dpdf', 'test_crop.pdf');

Like Rik wrote in the other report: This used to work differently in Octave 5.2, but changed in Octave 6.2.

Pantxo wrote:

> @Rik: The issue you noticed only happens with -dpdf (and -dps) paged devices: the problem is that the page is too small for the figure to fit in. In Octave 6, we switched to having the "paperpositionmode" property "auto" by default hence the difference with Octave 5.2: if the onscreen figure is larger than the "papersize", part of the figure are drawn outside the page. What does matlab do in this case? At least a warning would not hurt.

In Matlab R2020b, I see the following warning in this case:

>> print(hf, '-dpdf', 'test_crop_matlab.pdf');
Warning: The figure is too large for the page and will be cut off. Resize the figure, adjust the output size by setting the figure's PaperPosition property, use the 'print' command with either the  '-bestfit' or '-fillpage' options, or use the 'Best fit' or 'Fill page' options on the 'Print
Preview' window.
> In validate (line 146)
In print (line 67)

Maybe, we should emit a similar warning in this case.

CC'ing Rik and Pantxo.

Markus Mützel <mmuetzel>
Project Member


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

Attach Files:

Attached Files
file #51067:  bug60236.patch added by pantxo (1KiB - text/x-patch)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by pantxo (Updated the item)
  • -email is unavailable- added by mmuetzel (Submitted the item)
  • -email is unavailable- added by mmuetzel
  • -email is unavailable- added by mmuetzel

    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 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-03-20 mmuetzel StatusReady For Test => Fixed
        Open/ClosedOpen => Closed
    2021-03-15 mmuetzel StatusPatch Submitted => Ready For Test
    2021-03-15 pantxo Attached File- => Added bug60236.patch, #51067
        Item GroupRegression => Missed Error or Warning
        StatusConfirmed => Patch Submitted
    2021-03-15 mmuetzel Carbon-Copy- => Added rik5
        Carbon-Copy- => Added pantxo

    Back to the top

    Powered by Savane 3.7