bugGNU Octave - Bugs: bug #55019, new sgtitle function


bug #55019: new sgtitle function

Submitted by:  Marshall <marsian>
Submitted on:  Tue 13 Nov 2018 09:47:41 PM UTC  
Category:  Plotting Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Feature Request
Status:  None Assigned to:  None
Originator Name:  Marsian Open/Closed:  Open
Release:  dev Operating System:  Any

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


( Jump to the original submission)

Fri 30 Nov 2018 11:21:46 PM UTC, comment #6:

Comment #5 gives a decent work around, though I agree that it is not perfect. It took me a bit to figure out that text position attached to a figure is from -1 to 1 in x and y instead of 0 to 1, as is used to position axes (at least before an axis is placed).

The above places it at the top of a blank figure.

However, if I place this text before a subplot (e.g. subplot(5,5,3)), then the text moves position as soon as the subplot is created: relative to the axes position now (in data units of the placed axis). Text placed after an axes is created, then even with the figure as parent it is positioned relative to the data units of the last axes.

Marshall <marsian>
Thu 15 Nov 2018 12:06:53 AM UTC, comment #5:

It's not perfect, but you can create a text object that is attached to the figure and then move it around by changing the 'position' property.

Rik <rik5>
Project Administrator
Wed 14 Nov 2018 05:16:17 PM UTC, comment #4:

The parent of the sgtitle text is the figure. The parent of the standard title is the axes object. The parents of each of the subplot axes objects are also the figure.

Marshall <marsian>
Wed 14 Nov 2018 03:34:54 PM UTC, comment #3:

@Marsian: If you have access to Matlab 2018b it would be useful to know who's child the text object.is. Is it the axes that were current when creating the sgtitle text?

Pantxo Diribarne <pantxo>
Project Member
Wed 14 Nov 2018 12:26:41 AM UTC, comment #2:

It's a little more than just placing a single text object correctly. It also changes existing and new subplot sizes to give room for that text object so that it doesn't interfere with other titles or subplots.

Marshall <marsian>
Tue 13 Nov 2018 10:13:40 PM UTC, comment #1:

Looking at the documentation, sgtitle just creates a text object and then places it correctly. This shouldn't be that hard to do in an m-file. If anyone wants to take a stab at creating the function I can review and commit it.

Rik <rik5>
Project Administrator
Tue 13 Nov 2018 09:47:41 PM UTC, original submission:

As of 2018b, Matlab has a new function, 'sgtitle'. It would be nice if Octave had it too. It creates a single title centered at the top of the figure for a plot window with subplots, which could have their own separate titles via 'title'. A very handy function that I've had to do some odd workarounds to get similar functionality in the past.

Marshall <marsian>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by pantxo (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by marsian (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.




    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-11-13 rik5 Release4.4.1 => dev

    Back to the top

    Powered by Savane 3.4