Title over group of subplots

前端 未结 3 1774
猫巷女王i
猫巷女王i 2021-01-11 17:03

there are many subplots and each subplot has its own title. how can add a title over all of these group of subplots? I want this title to be shown at top center.

<         


        
3条回答
  •  攒了一身酷
    2021-01-11 17:30

    Since Matlab 2018b, the new function sgtitle adds a title to a subplot group, simply add sgtitle('Subplot Title');. It doesn't need a toolbox.

    For example:

    subplot(1,2,1)
    plot(cos(0:40));
    title('cos');
    
    subplot(1,2,2)
    plot(sin(0:40))
    title('sin');
    
    sgtitle('Trigo');
    

提交回复
热议问题