MATLAB Examples


The nantight function sets axis limits to the range of finite data. (2D plots only.) This is similar to the command axis tight; however, nantight only considers the extent of finite data.



newaxes = nantight(...)


nantight sets 2D axis limits to the range of fininite data.

nantight(h) performs nantight on an axis given by the handle h.

newaxes = nantight(...) returns the new axis limits in the form newaxes = [xmin xmax ymin ymax]


You have some data from a sensor, but the sensor failed on day 4 of 100. You would like to inspect the data that you do have. Let's start by making up some data:

t = 0:1/24:100; % hourly measurements for 100 days
y = sin(t);     % some data
y(96:end)=NaN;  % the sensor failed

By default a plot of your data will look like this:


If you want to inspect your data more closely you might first try the old axis tight command:

axis tight

And we see that axis tight does not help! So we use nantight:


Author Info

This function was written by Chad A. Greene of the University of Texas Institute for Geophysics, August 2014.