if you just want to use standard-matlab, you need a subtitle descriptor, and then you need its position. Then you set the legend position to the subtitle position. Referring to the documents:
Note. You can set the location of the legend by passing the 4-element position vector to the legend function using the "Location" option. To determine the position of an existing legend, use the set function to assign a position vector of 4 elements to the Position property. You cannot use the "Location" option with the function installed
eg:
subplot(2,3,1), plot(1:10,2:11) myLegend=legend('text1') set(myLegend,'Units', 'pixels') myOldLegendPos=get(myLegend,'Position') hold on h=subplot(2,3,6) set(h,'Units', 'pixels') myPosition=get(h,'Position') set(myLegend,'Position',[myPosition(1) myPosition(2) myOldLegendPos(3) myOldLegendPos(4)])
source share