Plot Geographic Data on a Map in MATLAB
MATLAB® makes it easy to plot data on top of a geographic basemap inside a MATLAB figure. Learn how you can use geographic plotting functions in MATLAB to display points, lines, text, density plots, and bubble charts on top of geographic basemaps. Choose from a range of basemaps available in MATLAB or load specialized web maps from a range of third-party sources. And if you need to create more advanced maps, perform geodesy calculations, or work with geographic file types, check out Mapping Toolbox™.
Published: 26 Dec 2018
Geographic displays provide insight into data with latitude and longitude components. Though you could display your geographic data in MATLAB as a plot of x and y, it will look distorted and won’t contain any contextual information such as political boundaries, roads, and other geographic features.
In MATLAB, geographic base maps can provide this background context when plotting your geographic data. These are tiled, multi-resolution web maps that allow you to pan and zoom on different regions of your plot, automatically loading new base map imagery as you do so.
MATLAB makes it easy to plot data on top of a geographic base map inside a MATLAB figure. There are two types of geographic maps you can make in a MATLAB figure. The simplest is a plot in a geographic axes, which behaves much like a regular MATLAB axes. Use plotting functions along with the hold on command to mix points, lines, text, and density plots in one geoaxes. Here’s an example of this type of plotting. We’ll first use geodensityplot, geoplot, and geoscatter to visualize our density, line, and point data respectively. Then we can customize the view of the data, changing the basemap and the limits, and annotating the plot with text, a legend, and a title.
The second type of geographic map in MATLAB is a geographic bubble chart, which can indicate a continuous variable by bubble size and a categorical variable by bubble color. This is a specialized chart type providing both bubble and categorical legends.
MATLAB’s base maps for global and regional scales are loaded from the web by default, but the data can also be downloaded from MATLAB Add-Ons to be used without an internet connection. Web maps with street-level data, topography, or other specialized base layer representations can be loaded from third-party sources. You can easily add web maps from a range of third-party sources using the addCustomBasemap function, available in Mapping Toolbox.
These functions for overlaying latitude and longitude data on web map base layers are available in MATLAB. If you need to go further, Mapping Toolbox provides additional functions for visualizing data in other projected coordinate systems, converting between systems, and performing geodesy calculations such as calculating distances and areas. Mapping Toolbox also allows you to read and write data between different types of standard geographic file types such as shapefiles, GPX files, and GeoTIFF files.
Featured Product
MATLAB
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.
Amériques
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asie-Pacifique
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)