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: Reza Housseini
Subject: Re: Trouble with Octave plots - can't display nor print in desired proportion
Date: Fri, 5 Jul 2013 07:40:30 +0200

On Fri, Jul 5, 2013 at 3:01 AM, Ben Abbott <address@hidden> wrote:

On Jul 4, 2013, at 8:41 PM, James Sheils wrote:

> On Thu, Jul 4, 2013 at 11:57 PM, Ben Abbott <address@hidden> wrote:
>> 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
>>
>
> Thankyou for your reply, Ben.
>
> However, when I type your code, I get the error:
>
> "error: get: unknown figure property paperpositionproperty"
>
> I'm sorry if I have misunderstood what you are saying!
>
> Thanks,
>
> James

James, first a couple points on mail-list etiquette, please don't top-post (do not reply at the top of the email).  Instead reply at the bottom so that those who arrive later can follow along.  Second, be sure the "reply-all".  The mail-list is archived in several locations, and we'd like to keep the entire conversation intact so that others looking for similar advice can find it via Google.

Regarding "paperpositionproperty", that was a typo on my part.  The correct property name is just "paperposition".

The positionposition property is a [1x4] double.  The first and second elements refer to the lower left corner of the figure (axes box with labels, etc).  The third and fourth elements are the width and height.  The units are designed in "paperunits" which is in inches by default.  The axes' "position" property is also a [1x4] double and also formatted as [xLL, yLL, width, height]. Its units are specified by the axes' "units" property, which is set to "normalized" by default (indication that xLL and width are normalized to paperposition(3) and yLL and height to paperposition(4).

Ben



_______________________________________________
Help-octave mailing list
address@hidden
https://mailman.cae.wisc.edu/listinfo/help-octave



If you use Latex, I would suggest to draw your plots with pgfplots [1]. There exists a wrapper for Octave/Matlab called matlab2tikz [2], but it's also easy to use if you save your data in csv files. There exists tons of customization to look your plots like you want it, without fiddeling with the internals of octave figure handles.




[1] http://pgfplots.sourceforge.net/
[2] https://github.com/nschloe/matlab2tikz 


reply via email to

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