help-octave
[Top][All Lists]
Advanced

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

Re: plot titles are off of the plot


From: Ben Abbott
Subject: Re: plot titles are off of the plot
Date: Sun, 25 Oct 2009 11:14:29 -0400


On Oct 25, 2009, at 10:32 AM, Stuart Edwards wrote:

On Oct 24, 2009, at 7:35 PM, charles reid wrote:

Hi Ben -

The plots I get are the same (both at http://charles.endoftheinternet.org/test1.png and http://charles.endoftheinternet.org/test2.png)

This solution solves my problem! Thanks for your help. (Also, in case it is still of interest, I am using a binary from SourceForge).


Charles

On Sat, Oct 24, 2009 at 16:12, Ben Abbott <address@hidden> wrote:

On Oct 24, 2009, at 6:09 PM, Ben Abbott wrote:

On Oct 24, 2009, at 4:19 PM, charles reid wrote:

On Fri, Oct 23, 2009 at 17:46, Ben Abbott <address@hidden> wrote:

On Oct 23, 2009, at 1:40 PM, charles reid wrote:

On Fri, Oct 23, 2009 at 06:52, Matthias Brennwald <address@hidden
wrote:

On Oct 23, 2009, at 2:29 PM, address@hidden wrote:

Hi -

I'm using Octave 3.2.0 on a Mac.  When I create plots, the
titles are not
entirely in the plot window (see attached "Picture 1.png").
I've tried
re-adjusting the physical position of the titles, but it doesn't
fix the
problem (the text is still cut off, or I have to make it overlap
with the
plot itself).  I see this behavior using GnuPlot with either X11
or Aquaterm
as my back-end.  The behavior is really annoying, since, to see
the actual
plot titles, I have to save the plot to an external file, which
looks fine
(see attached "Picture 2.png").  Does anybody have any idea what
is causing
this?  Is anyone else experiencing this problem?

Hi Charles

How did you create the PNG file? I believe your problem might be
related to this:

http://www.nabble.com/Axis-labels-in-EPS-figure-are-outside-bounding-box-td25941582.html#a25942083

Matthias

Yes, I'm generating these plots using the 'plot' command.  Is
there another graphics back-end that won't have this problem?

If you make an adjustment to the "position" property, you'll be
able to compensate for this *feature* of the gnuplot backend. The
developers are currentl working on a new backend, but printing is
not yet supported.

To compensate, try ...

     set (gca, "position", [0.26   0.22  0.645   0.705])

... and then try your print command again.

Ben

Hi Ben -

Thanks for the 'set' suggestion, but it doesn't work - it's moving
the plot itself, not the title.  I tried putting the command right
before and right after the title command, and putting it at the end
of all the commands related to the plot, but they all give the same
result - the plot, not the title, is shifted.

Charles

Please try one more time ...

       close all
       figure (1)
       plot (1:10)
       xlabel ("xlabel")
       ylabel ("ylabel")
       title ("title")
       print -dpng test1.png
       p = get (gca, "position");
       p(4) = p(4) - p(2);
       set (gca, "position", p)
       print -dpng test2.png

... and then email each png to me so that I can compare with what I see.

Also, please let us know how you obtained your octave from Fink,
MacPorts, or Sourceforge.

Thanks
Ben

I'm now attaching what I see as a follow up since attaching files often delays them being posted to the list.

Ben
apologies for jumping in....

In my case both the title and the xlabel are not displayed in Aquaterm. There is nothing wrong with the files that are created -- in both your tests I generate the same files that you get and both open with proper title and labels, although Test1 is better presentation - less white space at the top. However running your procedure does bring the title into view on Aquaterm during Test2 - do you have a suggestion for bringing the xlabel into view?

thx

Stu

10.6.1 / 3.2.2/ Sourceforge

The same approach can be used. The axis position property adjusts the lower left corner of the axis within the figure window, as well as the width and height of the axis. The position property is a 4 element vector. The 1st and 2nd elements are coordinates for the lower left corner. The 3rd and 4th elements are the width and height of the axis box. Thus, you can fix this problem by ...

       close all
       figure (1)
       plot (1:10)
       xlabel ("xlabel")
       ylabel ("ylabel")
       title ("title")
       p = get (gca, "position");
       p(3) = p(3)-2*p(1);
       p(4) = p(4)-2*p(2);
       p(1) = 2*p(1);
       p(2) = 2*p(2);
       set (gca, "position", p)

The above produces a rather small axis, so you may want to make some adjustments. Once you obtain a result that suits you, you may save the setting so that future plots use it as well.

        set (0, "defaultaxesposition", p)

If you want that to stick the next time you run octave, add that command to your ~/.octaverc file

        set (0, "defaultaxesposition", [0.26 0.22 0.515 0.595])

Ben

p.s. please respond at the bottom of the email so that the entire thread is easier for others to follow. Thanks.




reply via email to

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