# Zoomable Text

Jiro's pick this week is TextZoomable by Ken Purchase.

Today's entry was inspired by my colleague, Sean, who also guest posts for this blog from time to time. He and I are application engineers, traveling around the country evangelizing about MATLAB. We once traveled together, and I saw him present a seminar on image processing, which by the way was created by Brett. During the seminar, Sean showed an image that had some annotation to indicate that he was able to successfully differentiate straight lines from curvy lines, just by using image processing techniques. Because the auditorium was pretty big, some of the people in the back had difficulty reading the text. Sean promptly zoomed in using the zoom tool built into the figure.

Then I noticed something. The text became larger along with the image! Later, Sean told me that he was using a File Exchange entry that automatically scaled text when zooming. That was Ken's entry.

In the example below, I have added two text objects, one using MATLAB's text function (red) and the other using Ken's TextZoomable (blue). The syntax is exactly the same as that of text, so it's very easy to swap out the commands.

x  = -pi/2:0.01:pi/2;
y1 = 0.5*tan(0.8*x);
y2 = -0.7*tan(0.8*x);

plot(x, y1, 'b', x, y2, 'r')
xlabel('theta (\theta)')
ylabel('value (\psi)')

text(x(80), y2(80), '\leftarrow \psi = -.7tan(.8\theta)', ...
'FontAngle', 'italic', ...
'Color', 'red');
TextZoomable(x(80),y1(80),'\leftarrow \psi = .5tan(.8\theta)', ...
'FontAngle', 'italic', ...
'Color', 'blue');


Now, if I zoom in (note that you can do this interactively using the zoom tool), the blue text scales nicely with the zoom.

zoom(2)


This is great! This is a must-have for anyone presenting MATLAB graphics with annotation.

Published with MATLAB® R2013b

|

### コメント

コメントを残すには、ここ をクリックして MathWorks アカウントにサインインするか新しい MathWorks アカウントを作成します。