Hi MathWorks
I have a subplot consisting of four figures. For each figure I would like to add a name (MAPE) and the calculated value (perhaps in the top left corner of within the axes).
I have tried to work with text, legend or annotation, but without success.
At the moment the plots looks as one the attached .png-file. The value does not fit in the top left corner perfectly each time, it's too big in fontsize and does not look nice.
Is there any way to improve it and even add two more variables to the "text box" as I would also like RMSE and R^2?
The script for the plot looks as follows and I have attached a copy of the script and data:
f=figure;for i = 1:4 subplot(2,2,i); axis([min(fittedValues(:,i)) max(fittedValues(:,i)) min(meanReturns(:,i)) max(meanReturns(:,i))]); set(gca,'FontSize',6) ref = refline(1,0); ref.Color = plotColors(3,:); ref.LineWidth = 1.2; title(titles(1,i),'FontSIze', 7); xlabel('Model implied returns (in %)', 'FontSize', 6); ylabel('Avg. monthly realized returns (in %)', 'FontSize', 6); box on hold on labels = {'11','12','13','14','15','21','22','23','24','25',... '31','32','33','34','35','41','42','43','44','45','51','52','53','54','55'}; text(fittedValues(:,i),meanReturns(:,i), labels,'HorizontalAlignment','center','FontSize',6,'Color',plotColors(1,:)); text(min(fittedValues(:,i)), max(meanReturns(:,i))-0.05, sprintf('MAPE = %.4f', vwMAPE(i,1))) hold off end
All the best,
Christoffer
Best Answer