Klinger Matlab Scripts Barry A. Klinger, 20 May 2015 These are a few of the Matlab scripts I have found useful over the years. They are contained in three directories with a complete listing and brief descriptions shown below. The file guide2015.pdf includes a more pedagogical description of how to use the scripts and how they may improve scientific graphics for the geophysical sciences. In the future I may add more of my scripts to this collection. I make no guarantee about these scripts. Users must use them at their own risk. They seem to work well for me. Anyone is free to download, use, reproduce, or alter the scripts as they wish. Some of the scripts were not written by me, but as far as I know there is no limitation on their reproduction or use. If you find any of these scripts useful, please let me know. I am also happy to receive suggestions and will try to answer questions. I can be contacted at bklinger@gmu.edu. This is an update of a collection of scripts and documentation that I first posted in 2010. ---------------------------------------------------------------------- Graphics ---------------------------------------------------------------------- Graphing Routines arrow Plot an arrow, user controls various properties circle Draw an approximate circle with an n-gon colorpal Create useful colormaps from optimized examples contourfP contour w/ much better color control Calls colorpal, maptoint contour2 Different colors for +/-/0 (replaced by contourfP) contour4 contour2 w/ linewidth control (replaced by contourfP) expci Create +/- exponentially varying contour intervals maptoint Maps arbitr. numbers to integers for use with colorpal plateau Create plateau for each x-y gridbox. plotsev Plot a bunch of lines of data offset from each other quivcheck Quiver plot with data selected in checkerboard pattern quivcheckL quivcheck with special scaling for lat-lon coords. quivsqr quiver, lengths based on square root of magnitudes Figure and Axis Control are = axis('square') bigger make current figure 25% bigger (see also SMALLER) breaktaxis help break horizontal axis into 2 different scales landscape puts paper in landscape mode marker Multiply size of markers. newfig Place new figure in user-defined position and size originx Plot horizontal line showing x-axis. originy Plot horizontal line showing y-axis. overgrid Overlays grid on top of pcolor plot. paper set size of plotting window to be output to paper smaller makes current figure 20% smaller (see also BIGGER.M) textcorn text distance (xfact,yfact) from upper left corner. textsiz Change font size of all text in figure thickline Change width of all lines in current axis. top bring window with current figure to top of pile xaxis set limits of x axis of plot xyticksq Place labels on 1 axis at sqrt of label values. yaxis set limits of y axis of plot Other Graphics Routines expandcolor Exaggerate color differences in RGB image extend extend given line on a plot (either linear or log-log) kropit Crop image to 1.5:1 (good for 4X6 inch prints) Demonstration routines breaktaxisdemo breaktaxis.m condemo contour2.m and contour4.m, uses quivdemo.mat plateaudemo plateau.m, uses plateaudemo.mat quivdemo quivcheck.m and quivsqr.m, uses quivdemo.mat wrongright xaxis.m, textsiz.m, thickline.m ---------------------------------------------------------------------- Projections ---------------------------------------------------------------------- contglobeP Project global ocean data - latest version calls glatlon, loncycle, projea, projcont, xaxis, and contourfP glatlon Make lat-lon grid for equal-area equatorial projection calls projea globcont Contour global fields with projection (see contglobeP) glatlon, loncycle, projea, projcont, xaxis globcont2 Contour global fields with projection (see contglobeP) glatlon, loncycle, projea, projcont, xaxis globquiv Quiver global fields with projection (see quivglobe) loncycle, projea, projuvc, quivcheck globquiv2 Quiver global fields with projection (see quivglobe2) loncycle, projea, projuvc, quivcheck loncycle Change western and eastern boundaries of domain projcont Contour plot with equatorial projection calls projea, contour2 projea Azimuthal Equal Area Equatorial Projection projquiv Project 2D vector fields with equatorial projection calls projea; formerly called projuvc.m quivglobe Quiver global fields with projections - latest version Demonstration routine globdemo globcont.m, globcont2.m, globquiv.m, globquiv2.m also calls paper.m and loads bathhalfdeg.mat, surfvelclim.mat (in DemoData) ---------------------------------------------------------------------- DemoData ---------------------------------------------------------------------- bathhalfdeg.mat ETOPO5 global topogrsaphy averaged to .5 deg grid surfvelclim.mat Lumpkin and Garraffo 15 m velocity climatology ---------------------------------------------------------------------- Seawater ---------------------------------------------------------------------- This is a collection of scripts for calculating the density of seawater and related functions. Generally it's best to use the more accurate scripts rather than the simplified functions denpot1, potapprox, and sigapprox. alphbet calculate alpha and beta from equation of state calls denpot calccoefs coefficients for T dependence of density denpot calculates potential density given (S,theta,Pref) denpot1 approximation of potential density freez freezing temperature of water as function of S, P potemp potential temperature given S, T, P potapprox potential temperature, usual units for s,t,p sigma in situ density from press, in situ temp, salin sigapprox approximate (simplified) version of sigma.m