Mapping Toolbox | ![]() ![]() |
Example Two: Creating a Regional Map
Another way to easily plot worldlo
atlas data is by using the worldmap
tool. worldmap
plots a specified region using appropriate default projection parameters and map axes settings. worldmap
can be used to plot individual countries or entire regions. Here are some examples of valid worldmap
commands:
worldmap
also accepts latitude and longitude limits to define the area to be plotted. The following example uses worldmap
to create a map of North and South Korea. The maptool menu will then be added to the worldmap
figure and GUIs will be used to add a digital elevation map and plot the locations of earthquake epicenters. The korea
and koreaEQdata
workspaces used in this example are shipped with the Mapping Toolbox. The first step is to load the data we will be using:
To plot North and South Korea, first define the geographic limits of the area with the limitm
tool. Enter the following at the MATLAB command prompt.
The Map Limit Input dialog box appears.
Accept the default variable names and press Apply. The latlim
and lonlim
variables now contain the latitude and longitude limits of the korea
data. Now worldmap
can be used to plot the worldlo
data within these limits. At the MATLAB command prompt, enter:
For easy access to the Mapping Toolbox GUIs, we can now add the maptool
menu to the worldmap
figure. At the command prompt, enter:
The maptool
menu and mouse buttons are automatically added to the figure window:
Next we will plot the digital elevation data contained in the korea variables map
and maplegend
. Select MapRegular Surfaces from the menu bar. The Mesh Map Input dialog box appears:
The default map
and maplegend
variable names match the korea
variable names, so just press Apply. The surface object is added to the map:
To change the colormap, select ColormapsDigital Elevation from the menu bar. The DEM Colormap Input box appears. Enter the map variable
map
and press Apply.
To plot the locations of earthquakes, we will use the scatterm
GUI. Select MapScatter from the menu bar. The Scatter Map Input box appears. The variable containing the earthquake data is
kdata
. For the Latitude variable, enter kdata(:,1)
. For the Longitude variable, enter kdata(:,2)
. And for the Marker size, enter kdata(:,3).^2
, to display the markers in proportion to the earthquake magnitude. Squaring the magnitudes increases the difference in marker sizes, making them easier to distinguish. Change the Marker color to 'r
', and check the Filled box.
Press Apply and the earthquake markers are displayed:
To hide the coastlines, select ToolsHide
Object from the menu bar. The Select Object dialog box appears. Select
Coastline
and press Ok.
The coastlines are no longer displayed.
To make the country names a little bit easier to read, we will change the color from black to white. Select ToolsObjects from the menu bar. The Object Sets box appears. Select
Political Names
and press Property. In the Define Object Properties edit box, type 'Color','white'
and press Apply.
Next, we will change the edge color of the earthquake markers to better distinguish each earthquake site. The earthquake markers are patch objects, and are indicated in the Object Sets box as patch
. Select patch
and press Property. Enter 'MarkerEdgeColor','black'
and press Apply.
The map now appears as follows:
When we first plotted this map of korea, worldmap
selected the Lambert Equidistant Conic projection as appropriate for the location and size of the region. Suppose you would now like to switch to an equal area projection. Select DisplayProjection from the menu bar. From the Map Projection drop-down list, select the Equal Area Conic (Albers) projection. Press Apply, and all of the mapped objects are now projected onto the new projection.
Select ToolsHide from the menu bar to hide the Zoom, Rotate, and Origin buttons on the figure window. Select Tools
Axes
Invisible from the menu bar to hide the axes box.
Here is the final map of Korean earthquake locations:
![]() | Example One: Creating a World Map | Constructing Personalized Map Data with GUIs | ![]() |