Plot data labels with geoplot

24 ビュー (過去 30 日間)
Lorenzo Arcà
Lorenzo Arcà 2023 年 3 月 14 日
回答済み: Sai Sumanth Korthiwada 2023 年 3 月 27 日
Hi,
I am plotting a map coloured accordingly to the values of one variable (GDP change), and I would like to have a label with the value of the variable within each region. How can I do that?
My code currently look like this
% Import map
reg_map = readgeotable('src/shape/ita_regions/ita_regions.shp');
% Merge map with data
data_table = array2table(data, 'VariableNames', {var_name});
reg_map_data = [reg_map data_table];
% Plot figure
figure
geoplot(reg_map_data, ColorVariable = var_name)
The outcome looks like this

回答 (1 件)

Sai Sumanth Korthiwada
Sai Sumanth Korthiwada 2023 年 3 月 27 日
Hi Lorenzo,
Please use 'legend' to add a label with the value of the variable within each region.
Please refer to Add Labels and Annotations to Map Axes to know more about adding labels to plots.
Hope this resolves the query!

カテゴリ

Help Center および File ExchangeGeographic Plots についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by