help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: orient tall with fltk


From: Ben Abbott
Subject: Re: orient tall with fltk
Date: Tue, 08 May 2012 07:51:47 -0400

On May 8, 2012, at 4:51 AM, Jose wrote:

> Hi.
> 
> I am still a bit lost and I'd like to learn what I am doing wrong. Please, 
> let me know where I make the mistake in my line of thought. Thanks in advance 
> for your patience.
> 
> Let me recap, as I might have not been clear with my problem. My goal is to 
> produce a print in pdf (ultimately with pdflatex, and that is why fltk is a 
> must) with small margins, that is: a paper filled with the figure. The orient 
> command can be used for this, as it is supposed to orient the paper and scale 
> the figure to fit the page with a 0.25 inch border.
> 
> Using orient with gnuplot works nicely, whereas with fltk it does not, as the 
> figures are not scaled properly to fill the paper.
> 
> What somehow works is to adjust manually the sizes of the figure and the 
> paper so that they are the same, making sure that the size fits in the 
> screen. In this sense one can first define the size of the paper first and 
> then adjust the size of the figure or viceversa. For example:
> 
> *Adjusting the size of the paper to the size of the figure:
> ----
> clear all;graphics_toolkit fltk;
> plot (rand (3))
> fig_size=get(gcf,'position')(3:4); %in pixels
> paper_size=fig_size/72; %in inches, gives [7.7778 5.2778]
> border = 0;
> set (gcf,'papertype', '<custom>');
> set (gcf,'paperunits', 'inches');
> set (gcf,'paperorientation','landscape')
> set (gcf,'papersize', paper_size);
> set (gcf,'paperposition', [border, border, (paper_size - 2*border)]);
> print foo1.pdf
> ---
> 
> *Adjusting the size of the figure to the paper
> ----
> clear all;graphics_toolkit fltk;
> paper_size=[10 6]; %in inches
> border = 0;
> set (gcf,'papertype', '<custom>');
> set (gcf,'paperunits', 'inches');
> set (gcf,'paperorientation','landscape')
> set (gcf,'papersize', paper_size);
> set (gcf,'paperposition', [0, 0, paper_size]);
> fig_size=(paper_size-2*border)*72;%in pixels
> set (gcf,'position',[0 0 fig_size]);
> plot (rand (3))
> print foo2.pdf
> ---
> 
> The results are similar in both cases, and although better than using orient, 
> the figure has still somehow large margins even with border=0. Compare the 
> attached foo1.pdf with foo3.pdf, which was generated using the same code but 
> with gnuplot instead of fltk.

Adding the -tight option to the print command will improve the border/margin 
result (ghostscript will be used to crop the pdf).

However, if you like the convenience of "orient tall", the tightness of of 
gnuplot's output, and wish to use pdflatex, there is a way to do all of that.

        close all;
        graphics_toolkit gnuplot;
        plot (rand (3))
        set (gca,'activepositionproperty','outerposition')
        orient tall
        print -depsstandalone foo
        system ("epspdf foo-inc.eps");

Then type "pdflatex foo.tex" from the shell prompt, and you should get 
something like the attached foo.pdf. Does that do what you want?

Ben

Attachment: foo.pdf
Description: Adobe PDF document






reply via email to

[Prev in Thread] Current Thread [Next in Thread]