简体   繁体   中英

Easy way(builtin function) to put Main title in plot in octave

I'm using octave for plotting subplots in same plot and want to add general title isn't there any builtin function like sgtitle in matlab as in that this old question there was a solution but not using any cool builtin functions and octave dosen't.also here Octave - Bugs: bug #55019, new sgtitle function I find there is sgtitle in octave but can't find doc or package name or any thing...is it not fully implemnted yet or some alternative???

I'm asking about package or bultin function not implementation I'll write or copy from someone

Depends on your definition of "builtin function" vs 'workaround'.

A full-window title is simply a title positioned with respect to an empty 'whole window' axis, as opposed to subtitles which are positioned with respect to subplots which take up only a fraction of the window at specific positions.

Therefore the 'builtin' way to add a title on an empty whole-window axis, is to simply add a title on an empty whole-window axis.

t = 0:0.01:2*pi;
hold on
s1 = subplot( 2, 2, 1 ); plot( t, sin(t) ); set( s1, 'title', 'Sine of t' );
s2 = subplot( 2, 2, 2 ); plot( t, cos(t) ); set( s2, 'title', 'Cosine of t' );
s3 = subplot( 2, 2, 3 ); plot( t, tan(t) ); set( s3, 'title', 'Tangent of t' );
s4 = subplot( 2, 2, 4 ); plot( t, cot(t) ); set( s4, 'title', 'Cotangent of t' );
S  = axes( 'visible', 'off', 'title', 'Trigonometric Functions' );
hold off

In my opinion, this is as 'builtin' as it gets (in that, I don't think of setting a title on a main axes object to be any less of a builtin functionality than setting a title on the individual subplot axes objects).

If by 'builtin' you meant "I'd like to use a single-word command to do this instead of relying on built-in graph properties", then no, octave does not provide such a convenience function.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM