Tight subplot with colorbars and subplot's 3rd parameter in Matlab?

后端 未结 2 502
天涯浪人
天涯浪人 2021-01-16 18:59

I would like to have a tight subplot i.e. minimum spacing between figures in the subplot where

  • you have subplot\'s 3rd parameter i.e. you can decide where the
2条回答
  •  甜味超标
    2021-01-16 19:11

    The third parameter of tight_subplot defines the gaps between axis objects. For the built-in subplot command, the third parameter defines which axis is set as the CurrentAxes of the Figure. This option is not available in tight_subplot because I personally did not find it useful. Typically, I use the returned axes handles to specify where to add graphics.

    Existing axes objects are repositioned when you add a colorbar.

    I have added a second output argument to tight_subplot which provides the output position of the axes so that you can "reset" the axes positions after adding a colorbar.

    [hax, position] = tight_subplot();
    
    % Add a colorbar which alters the positions
    colorbar();
    
    % Now reset the positions back to where they were
    set(hax, {'Position'}, pos);
    

提交回复
热议问题