octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #31610] Text in subplot overlaps


From: Ben Abbott
Subject: [Octave-bug-tracker] [bug #31610] Text in subplot overlaps
Date: Thu, 02 Dec 2010 12:55:34 +0000
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_5; en-US) AppleWebKit/534.7 (KHTML, like Gecko) Chrome/7.0.517.44 Safari/534.7

Follow-up Comment #6, bug #31610 (project octave):

(repost)

Looking at Matlab's documentation for what "align" does …


SUBPLOT(m,n,p,'align') places the axes so that the plot boxes are aligned,
but does not prevent the labels and ticks from overlapping.


My first thought was that "align" implies that activepositionproperty is set
to "position", and that the default would be "outerposition".

However, the commands below …


h1 = subplot(2,2,1);
h2 = subplot(2,2,1,'align');
get (h1, 'ActivePositionProperty')
ans = position
get (h2, 'ActivePositionProperty')
ans = position


… indicate that, for Matlab, the activepositionproperty is always set to
"position". I think this implies that callbacks are used to set the position
of the plot box and that the position is dependent upon the position and
extents of the tick and axes labels.

Unfortunately, we don't have a reliable method to determine the position and
extents of text for gnuplot (David Batemann recently tried, so I've cc'd
him).
I see three options.

0 Patch gnuplot to provide the needed text information.
0 Make another attempt to calculate the position and extents in
Octave.
0 Interpret "align" to imply the activepositionproperty is "position",
and "outerposition" otherwise.

The first two options are in need of a volunteer. Once/if the text extends
are available the axes properties "position", "outerposition", and
"tightinset" will need to be properly determined. Legends are also impacted
(others that are slipping my mind?). This would require a lot of effort,
which
I think would be better invested in the OpenGL backends.

The third option is a trivial fix. This will only  produce the intended
effect if all subplots have same activepositionproperty. In that case, the
effect of _not_ specifying "align" would be identical to the commands below.


demo ("subplot", 1);
set (findobj (gcf, "type", "axes"), "activepositionproperty",
"outerposition")


If the third approach is acceptable, I can implement it.

Matlab's documentation for subplot describes the effect of "replace" as ...

If a SUBPLOT specification causes a new axes to overlap an existing axes,
the
existing axes is deleted - unless the position of the new and existing axes
are identical.  For example, the statement SUBPLOT(1,2,1) deletes all
existing
axes overlapping the left side of the Figure window and creates a new axes
on
that side - unless there is an axes there with a position that exactly
matches
the position of the new axes (and 'replace' was not specified), in which
case
all other overlapping axes will be deleted and the matching axes will become
the current axes.


It looks to me like Octave is behaving correctly when "replace" is _not_
specified.


octave:1> h = subplot (2,2,1)
h = -1.2334
octave:2> h = subplot (2,2,1)
h = -1.2334
octave:3> h = subplot (1,2,1)
h = -5.0747


Specifying "replace" would return a new axes handle for the second subplot
command. This should be a simple fix.

I've attached a changeset adding support for the "replace" option and have
included the 3rd option for
"align".


(file #22089)
    _______________________________________________________

Additional Item Attachment:

File name: changeset.patch                Size:2 KB


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?31610>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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