Be the first to rate this file! 101 downloads (last 30 days) File Size: 3.12 KB File ID: #25666

Mouse-friendly FIGURE

by Rody Oldenhuis

 

27 Oct 2009

Code covered by BSD License  

Same as FIGURE, but zooming/panning is done more conveniently with scroll wheel/clicks.

Download Now | Watch this File

File Information
Description

MOUSE_FIGURE(handle) creates a figure (or modifies an existing one with handle [handle]) that allows zooming with the scroll wheel and panning with mouse clicks, *without* first selecting the ZOOM or PAN tools from the toolbar. Moreover, zooming occurs to and from the point the mouse currently hovers over, instead of to and from the less intuitive "CameraPosition" as is the case with the default ZOOM. Naturally, the classical ZOOM and PAN toolbar icons are left unaltered.

Mouse button functionality:
Scroll: zoom in/out
Left click: pan
Double click: reset view to default view
Right click: set new default view

LIMITATIONS: This function (re-)efines several functions in the figure (WindowScrollWheelFcn, WindowButtonDownFcn, WindowButtonUpFcn and WindowButtonMotionFcn), so if you have any of these functions already defined they will get overwritten. Also, MOUSE_FIGURE() only works properly for 2-D plots. As such, it should only be used for simple, first-order plots intended for "quick-n-dirty" data exploration. Only tested on MATLAB 2009a, on WinXP platform.

EXAMPLE:

   mouse_figure;
   x = linspace(-1, 1, 10000);
   y = sin(1./x);
   plot(x, y)

MATLAB release MATLAB 7.8 (R2009a)
Zip File Content  
Other Files license.txt,
mouse_figure.m
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
figure Rody Oldenhuis 28 Oct 2009 09:21:06
plot Rody Oldenhuis 28 Oct 2009 09:21:06
axes Rody Oldenhuis 28 Oct 2009 09:21:06
zoom Rody Oldenhuis 28 Oct 2009 09:21:06
pan Rody Oldenhuis 28 Oct 2009 09:21:06
scrollwheel Rody Oldenhuis 28 Oct 2009 09:21:06
scroll Rody Oldenhuis 28 Oct 2009 09:21:06
graphics Rody Oldenhuis 28 Oct 2009 09:21:06
data exploration Rody Oldenhuis 28 Oct 2009 09:21:06
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com