What's wrong with this textbox annotation?

17 views (last 30 days)
I'd like to create a textbox annotation in a figure called "figure1", but it always gives me an error saying that there are too many input arguments for "annotation". Here's what I do:
annotation(figure1,'textbox',[0.2726 0.638 0.1111 0.05249],...
'String',{'Slope = Hp'},...
'HorizontalAlignment','center',...
'FontSize',14,...
'FitBoxToText','off');
What's wrong with this?
  1 Comment
per isakson
per isakson on 13 Jul 2013
Edited: per isakson on 13 Jul 2013
Which Matlab release? It works here with R2012a.

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 13 Jul 2013
It worked for me. You did do this before you called it, didn't you:
figure1 = figure;
  3 Comments
Image Analyst
Image Analyst on 13 Jul 2013
Edited: Image Analyst on 13 Jul 2013
Run this:
figure1 = figure;
annotation(figure1,'textbox',[0.2726 0.638 0.1111 0.05249],...
'String',{'Slope = Hp'},...
'HorizontalAlignment','center',...
'FontSize',14,...
'FitBoxToText','off');
It gives no errors or warnings whatsoever. Is it possible you redefined annotation() with your own function? What does this say:
>> which -all annotation
dave
dave on 14 Jul 2013
Thanks Image Analyst...I had some toolbox installed which contained a function "annotation". So I renamed the function and now everything works as expected.

Sign in to comment.

More Answers (0)

Categories

Find more on Specifying Target for Graphics Output in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!