资源简介
风场图——mtalab风场图——mtalab风场图——mtalab风场图——mtalab
代码片段和文件信息
function ncquiverref(xyuvunitsreftyperefvecveccolcont)
% NCQUIVERREF: Vector plotting function for either map or Cartesian axes.
% function ncquiverref(xyuvunitsreftyperefvecveccolcont)
% This function is a substitute for the standard version of quiver
% and quiverm available using a vanilla release of matlab. This version
% assumes a 2D vector field being plotted using a gridded flow field
% from numerical models with a regular geometry. The function enables
% the scaling of vectors according to a reference vector plotted in the
% lower right hand corner of the plot axes. The function works for both
% map and Cartesian axes and allows the color of vectors to be changed.
%
% If a reference value is not provided the reference value is calculated
% by rounding the median or maximum lengths of the quiver vectors to the
% first significant digit. Scaling of vectors still occurs even
% if the reference vector plotting is switched off. This enables
% different subplots to share identical scaling so that the relative
% magnitude of vectors can be compared between subplots (provided they
% share the same grid).
%
% The function includes the ability to plot color vectors all of equal
% length but color coded according to their magnitude. In this case a
% colorbar is provided complete with units and no scaling vector is
% plotted.
%
% Input:
% x - x-coordinate or latitude
%
% y - y-coordinate or longitude
%
% u - u-component (Cartesian +x-direction map +longitude-direction)
%
% v - v-component (Cartesian +y-direction map +latitude-direction)
%
% units - a string providing the units of the vector field. This assumes
% the default Tex or Latex interpreter is being used as set
% elsewhere using set(0‘DefaultTextInterpreter‘‘tex‘).
%
% reftype - character variable specifying the type of reference vector.
% Allowable values are ‘median‘ for giving a reference
% vector based on the median or ‘max‘ for giving the
% reference vector based on the maximum. This argument may
% be omitted with ‘max‘ as the default. If reftype is entered
% as a number then this is the value of the reference vector
% in the units of the data in u and v. If veccol is set to
% ‘col‘ this argument has no effect and should be entered
% only as a dummy argument.
%
% refvec - logical that turns off or on the plotting of the reference
% vector scale for plotting vectors. The default is ‘true‘.
%
% veccol - color of the vectors to be plotted. This may either be in the
% form of RGB or as a single letter such as ‘b‘ for blue
% using standard Matlab color specifications. This may be set
% to ‘col‘ if the vectors are to be color coded by magnitude
% instead of sized by magnitude. In this case all vectors
% have the same size based on the optimum value for the grid
%
评论
共有 条评论