help-octave
[Top][All Lists]
Advanced

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

Re: Trouble with Octave plots - can't display nor print in desired propo


From: Ben Abbott
Subject: Re: Trouble with Octave plots - can't display nor print in desired proportion
Date: Thu, 04 Jul 2013 18:57:17 -0400

On Jul 4, 2013, at 1:47 PM, James Sheils wrote:

> Firstly, I would like declare I am new to the list! I have been using Octave 
> for around 2 weeks now, and have found it to be a great way to create plots a 
> series of problem sets I am creating for my physics students.
> 
> However, I have run into difficulty when trying to get the plots to display 
> the axes in the proportion I wish.
> 
> I am running:
> 
> Mac OSX: 10.8.4 (Mountain Lion), Octave: 3.6.4, GNUplot: 4.6 patchlevel 3, 
> Aquaterm: 1.1.1
> 
> My code plots 2d functions with grid lines resembling graph paper so that 
> students can easily interact with the plot (draw tangent and calculate 
> gradient, read off values, sketch other plots on the same axes, etc...).
> 
> The goal is to have the plot print on the page with 1cm graph paper.
> 
> My progress is such that I have everything in place except one thing - I 
> can't get the figures to print in the right size! I can't even get them to 
> print in the correct proportion.
> 
> Ideally, I'd like to save a pdf from the Aquaterm window, as I think the 
> plots look better that way. My plan was to import the pdf into LaTeX at a 
> consistent width (say, 15cm), and then have the code scale the graphs 
> accordingly. However, this has not been working at all.
> 
> There are two variable to input:
> 
> length of x axis (in cm), length of y axis (in cm)
> 
> Assume that the paper width is 15cm, and that the x axis never exceeds this 
> length.
> 
> NOTE: I do not wish the axes values to be in proportion (I don't want '1.0' 
> on the x axis to necessarily be the same length as '1.0' on the y axis).
> 
> I am in quite a muddle about which commands I should be using... any help 
> would be greatly appreciated!

Are you familiar with the axes "position" property, and the figure's 
"paperposition" property?  The physical height and width of the axes box will 
be ...

        height = get (gca (), "position") (4) * get (gcf (), 
"paperpositionproperty") (4)

        width = get (gca (), "position") (3) * get (gcf (), 
"paperpositionproperty") (3)

If you set these property values correctly you'll get the result you're looking 
for.  Note, you only need to modify the "paperpositon".  If you take that 
approach what you see on the screen will not be effected.

Ben



reply via email to

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