MATLAB Examples

scattertextm documentation

This function creates color-scaled text labels on maps.

Contents

Syntax

scattertextm(lat,lon,c)
scattertextm(...,text)
scattertextm(...,'colormap',ColorMap)
scattertextm(...,'TextProperty',TextValue)
scattertextm(...,'clim',[cmin cmax])
h = scattertextm(...)

Description

scattertextm(lat,lon,c) places numeric values c as text labels centered on lat,lon and color-scaled to the values of c using the current colormap.

scattertextm(...,text) scales color of cell array text to values of c.

scattertextm(...,'colormap',ColorMap) specifies a colormap for text, and does not hijack the current colormap or affect the colorbar in any way.

scattertextm(...,'TextProperty',TextValue) formats text labels with 'fontweight', 'fontangle', etc.

scattertextm(...,'clim',[cmin cmax]) specifies limits of color scaling. This can be useful if you want to match label colors to current color axis limits. That'd be accomplished with ...,'clim',caxis). By default, limits are [min(c) max(c)].

h = scattertextm(...) returns a label handle h.

Example

This file comes with some sample population data. Let's look at the population of the 100 largest US cities not including New York, LA, Chicago, or Houston. Below I'm using my borders function to plot state borders and Stephen Cobeldick's brewermap function for the white-to-red colormap.

figure('pos',[100 100 860 490])
load population_data
borders('contintental us','color',.3*[1 1 1])
scattertextm(lat(1:95),lon(1:95),population(1:95),city(1:95),...
    'colormap',brewermap(256,'reds'))

Author Info

This function was written by Chad A. Greene of the University of Texas at Austin's Institute for Geophysics, June 2015.