Global Index (all files) (short | long) | Local Index (files in subdir) (short | long)
q = quiver_label_giso(u,scale,xtext,ytext,type)
USAGE: quiver_label_giso(U,scale,xtext,ytext,type) Puts a "scale" vector on a map from the Map Toolbox U = magnitude of scale vector scale = scale of vectors plotted xtext = left position of text ytext = y-position of text and scale vector type = arrow parameters (from quiver) PROBLEM: First, we should note that there is no 'good' way to draw arrows in MATLAB, unless the map is evenly spaced in the x and y directions. Unless the grid is evenly spaced, the arrow length will not be correct - there's no way around that. As a result, this should only be used for 'giso' projection - or for evenly spaced projections. Use at your own discretion.
| This function calls | |
|---|---|
function q = quiver_label_giso(u,scale,xtext,ytext,type)
isheld = ishold;
if ~isheld; hold on; end;
if nargin < 5; type = '-k'; end
% Get x and y limits
xx1 = get(gca, 'XLim'); yy1 = get(gca, 'YLim');
xx2 = getm(gca, 'MapLonLimit'); yy2 = getm(gca, 'MapLatLimit');
scalex = diff(xx1)/diff(xx2);
scaley = diff(yy1)/diff(yy2);
xtext2 = xx1(1)+scalex*(xtext-xx2(1));
ytext2 = yy1(1)+scaley*(ytext-yy2(1));
%xarrow2 = xx1(1)+scalex*(xarrow-xx2(1));
u2 = u*scalex;
q1 = text(xtext2,ytext2,sprintf('Scale: %1.4g m/s = ',u),'FontSize',8)
set(q1, 'HorizontalAlignment', 'right');
q2 = quiver_scale(xtext2,ytext2,u2,0,scale,type);
set(q2,'Clipping','off')
if nargout == 1;
q = [q1; q2];
end
if ~isheld; hold off; end;