File Exchange Pick of the Week

Our best user submissions

Zoomable Text 2

Posted by Jiro Doke,

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.


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


Let us know what you think here or leave a comment for Ken.

Get the MATLAB code

Published with MATLAB® R2013b


Comments are closed.

2 CommentsOldest to Newest

Yair Altman replied on : 1 of 2

Nice as this utility is, if you’re serious about zooming in presentation, I suggest using Microsoft’s free ZoomIt utility, which is trivially easy to use and can easily zoom into anywhere onscreen (not just Matlab plots). It can also annotate in real-time and other useful features developed specifically for presentations.

(developed by Mark Russinovich of SysInternals [that was acquired by Microsoft] – the author of Process Explorer and other invaluable utilities that no serious Windows programmer can do without)

Like the rest of the SysInternals utilities, ZoomIt is free and *extremely* robust and high-quality.

Jiro Doke replied on : 2 of 2


Thanks for bringing this up! In fact, pretty much all MathWorks application engineers have ZoomIt installed and use it for our presentations. It’s definitely a must-have tool for us.

One thing to point out is that ZoomIt will zoom in at the current resolution, and it won’t resample at the higher resolution.