bugGNU Octave - Bugs: bug #46122, gnuplot printed figure truncated

 
 

bug #46122: gnuplot printed figure truncated

Submitted by:  ederag <ederag>
Submitted on:  Sun 04 Oct 2015 04:12:59 PM UTC  
 
Category: Plotting with gnuplotSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: FixedAssigned to: Kai Torben Ohlhus <siko1056>
Originator Name: EderagOpen/Closed: Closed
Release: 4.0.0Operating 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)

Fri 18 Dec 2015 08:50:27 PM UTC, comment #11:

With the fix for 46292 pushed, I think this bug/problem is also fixed.

http://hg.savannah.gnu.org/hgweb/octave/rev/80dd7b3529ee

Ben Abbott <bpabbott>
Project Member
Wed 16 Dec 2015 07:09:17 PM UTC, comment #10:

@Ederag,
My point on the axis units, is that it's size on the screen is not related to the size of the output produced by print() or saveas(). To produce a figure of a specified size and with a specified font for publication purposes, all that is needed is to specify the font size of all the objects and to specify the paperposition width and height.

If you use -dpdf, then you also need to specify the paper size.

If you desire a wysiwyg solution, please refer to the two comments below on bug report 46292.

https://savannah.gnu.org/bugs/?46292#comment15
https://savannah.gnu.org/bugs/?46292#comment16

The script I provided works for the qt graphics toolkit. If you like I can try to work out one for gnuplot as well. The primary difference is that the figure size for gnuplot needs to be spedified when the figure is created.

Ben Abbott <bpabbott>
Project Member
Wed 16 Dec 2015 06:37:08 PM UTC, comment #9:

Dear Ben, here is the rationale for setting "DefaultAxesUnits" to "centimeters".
I was preparing a figure for a paper, with several sub plots, a colorbar spanning the whole figure...
Since the figure width has to be fixed to the article width, and since I have a better feeling of the good sizes in centimeters, it seemed sensible to control all positions in centimeters too.

Maybe "need" is a bit strong. Of course it would be possible to write a function converting (X, Y) positions from centimeters to normalized units. Less elegant, but working.

On the other hand, according to the documentation, using centimeters units should work.

One other very important point when preparing a complex figure, is that the size on screen should be the same as the final one in the article. Then it is much faster to arrive at the desired result.
This is why I insist to set the figure position also
(this is working fine if defaultfigureunits is set to centimeters beforehand).

ederag <ederag>
Tue 15 Dec 2015 09:33:05 PM UTC, comment #8:

No, I need 'DefaultAxesUnits', 'centimeters'.
I'll try again tomorrow to explain why.

About paperorientation, matlab is pure non-sense about that,
and I was glad that octave did not comply.
But this is really another story.

ederag <ederag>
Tue 15 Dec 2015 09:16:51 PM UTC, comment #7:

Ederag,

The figure "position" specifies the location the figure is placed on your monitor and has no effect when printing. The "defaultaxesunits" also do not impact printing.

Regarding the orientation, if you do not change the orientation, your example should work. Specifically, the example below works for me.

There is a bug present, but it is not what you think. The bug is that changing the paperorientation modifies the value of the paperposition. This should not happen (according the Mathworks documentation and confirmed by testing).

Ben Abbott <bpabbott>
Project Member
Tue 15 Dec 2015 08:49:56 PM UTC, comment #6:

Dear Ben, you missed the figure positioning and the 'DefaultAxesUnits', 'centimeters'.

These are need to control the figure in (approximated) wysiwyg mode. Please see the modified script attached.
Unfortunately, these trigger the truncated printout.

The orient stuff is not relevant here (or needed by the way).

(file #35755)

ederag <ederag>
Tue 15 Dec 2015 01:32:30 PM UTC, comment #5:

This is a regression. When printing GL2PS requires (by design) that the figure be scaled such that there is 1 pixel for each point to be rendered. To avoid toolkit specific code in _print_parse_opts_.m and in print.m, the same convention is done for gnuplot.

As a result, this change results in an incorrect figure size. On my system, my screen resolution is 129 pixel/in, and this change reduces the intended size by 72/129. Thus, the standard 8x6 output is reduced to 4.4651x3.3488.

Thus, this changeset will need to be reverted.

@Ederag, I've looked over you m-file and have edited it to provide the behavior you desire. You can simpify this task and avoid worrying about the papersize and orientation by just specifying the paperposition and then using the -dpdfwrite terminal.

Both my modified m-file and the simplified commands assume this change is reverted.

(file #35750)

Ben Abbott <bpabbott>
Project Member
Tue 06 Oct 2015 09:10:37 AM UTC, comment #4:

Done http://hg.savannah.gnu.org/hgweb/octave/rev/af5591ef9790 .

Kai Torben Ohlhus <siko1056>
Project MemberIn charge of this item.
Tue 06 Oct 2015 07:35:17 AM UTC, comment #3:

Please use my address in the "To" field of this message.
Thank you !

ederag <ederag>
Tue 06 Oct 2015 07:19:44 AM UTC, comment #2:

Thank you for you patch. Your changes look reasonable and I'll push them. How do you want to get mentioned as Author ederag? The pattern is

"John W. Eaton <jwe@octave.org>"

Kai Torben Ohlhus <siko1056>
Project MemberIn charge of this item.
Sun 04 Oct 2015 08:21:51 PM UTC, comment #1:

I tested your changes, they work for me.

As a sidenode, I think something went wrong with the format of your patch. It should probably not refer to a .orig file.

Stefan Miereis <stefanm>
Sun 04 Oct 2015 04:12:59 PM UTC, original submission:

Trying to create a figure for an article, with custom size,
specified in centimeters, the screen output was really fine,
while the printed output was truncated.

The fix was to use the actual "ScreenPixelsPerInch" instead of 72
in _gnuplot_drawnow_.m.

Please find a patch attached,
as well as a small script to reproduce the bug.

ederag <ederag>

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #35750:  script_wysiwyg_modified.m added by bpabbott (543B - application/octet-stream)
file #35058:  script_wysiwyg.m added by ederag (858B - text/x-matlab)
file #35059:  __gnuplot_drawnow__.m.patch added by ederag (715B - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by bpabbott (Updated the item)
  • -unavailable- added by siko1056 (Posted a comment)
  • -unavailable- added by mtmiller (Updated the item)
  • -unavailable- added by stefanm (Posted a comment)
  • -unavailable- added by ederag (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 9 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 15 Dec 2015 08:49:56 PM UTCederagAttached File-=>Added script_wysiwyg_modified_fixpos_simpler.m, #35755
    Tue 15 Dec 2015 01:32:30 PM UTCbpabbottAttached File-=>Added script_wysiwyg_modified.m, #35750
      Originator Name=>Ederag
    Tue 06 Oct 2015 09:10:37 AM UTCsiko1056StatusPatch Submitted=>Fixed
      Open/ClosedOpen=>Closed
    Tue 06 Oct 2015 07:20:39 AM UTCsiko1056Assigned toNone=>siko1056
    Mon 05 Oct 2015 11:58:04 PM UTCmtmillerStatusNone=>Patch Submitted
    Sun 04 Oct 2015 04:12:59 PM UTCederagAttached File-=>Added script_wysiwyg.m, #35058
      Attached File-=>Added _gnuplot_drawnow_.m.patch, #35059

    Back to the top


    Powered by Savane 3.1-cleanup1