What does tight_subplot return in MatLab?

416 views Asked by At

What does tight_subplot return in MatLab?

The documentation says the following:

   out:  ha     array of handles of the axes objects
                    starting from upper left corner, going row-wise as in
                    going row-wise as in

(and yes that typo is in the documentation verbatim).

When I print out ha, for example, it shows floating point values:

>> ha=tight_subplot(2,1,[.001 .001],[.1 .1],[.1 .1]);
>> ha

ha =

    0.0037
    1.0037

What do these values represent? And, how are these floating point values also "handles" as they are called in the documentation?

Thanks.

1

There are 1 answers

0
Benoit_11 On

In short, those values do not mean anything by themselves in the sense that they are only floating point values. They actually refer to the actual object created by the tight_subplot function, that is each individual subplot/axes created.

Here ha is actually a 2x1 array containing the reference to both axes created, which you can modify as you wish using Property/Value pairs using ha(1), ha(2),...ha(k) for k axes.

For instance, after writing your code above, you can make the 2nd axes (i.e. the 2nd object created by the function) not visible like so:

set(ha(2),'Visible','off')

Hence ha(...) refers to the axes created by the function.

You can fetch every property of those axes using the get command:

get(ha(1)) 

for example.

Hope this is clearer!