Error in Geobubble Map Chart

2 Ansichten (letzte 30 Tage)
Adriano Zanfei
Adriano Zanfei am 24 Apr. 2020
Kommentiert: Walter Roberson am 24 Apr. 2020
Hello There!
I am very novice to Matlab and therefore please be patient!...
Following one of the example for Geobubble Map chart
I am trying to get myhown geobubble map of a selected table,
head(newGps, 5)
ans =
5×12 table
data stato codice_regione denominazione_regione codice_provincia denominazione_provincia sigla_provincia lat long totale_casi note_it note_en
_______________________ _______ ______________ _____________________ ________________ _______________________ _______________ ______ ______ ___________ _______ _______
{'2020-04-23T17:00:00'} {'ITA'} 13 {'Abruzzo' } 69 {'Chieti' } {'CH'} 42.351 14.168 677 NaN NaN
{'2020-04-23T17:00:00'} {'ITA'} 13 {'Abruzzo' } 66 {'L'Aquila'} {'AQ'} 42.351 13.398 241 NaN NaN
{'2020-04-23T17:00:00'} {'ITA'} 13 {'Abruzzo' } 68 {'Pescara' } {'PE'} 42.465 14.214 1236 NaN NaN
{'2020-04-23T17:00:00'} {'ITA'} 13 {'Abruzzo' } 67 {'Teramo' } {'TE'} 42.659 13.704 631 NaN NaN
{'2020-04-23T17:00:00'} {'ITA'} 17 {'Basilicata'} 77 {'Matera' } {'MT'} 40.668 16.598 183 NaN NaN
I can succeafuly print the map,
websave('province_last.csv', 'https://raw.githubusercontent.com/pcm-dpc/COVID-19/master/dati-province/dpc-covid19-ita-province-latest.csv');
tableGps = readtable('province_last.csv');
tableGps = tableGps(~contains(tableGps.denominazione_provincia,'In fase di definizione/aggiornamento'),:); %remove wrong lat long zeros
figure()
gb = geobubble(newGps,'lat','long','SizeVariable','totale_casi','Title','Mappa del contagio Covid-19: totale casi confermati');
gb.MapLayout = 'maximized'
but I got an error on the next step:
gb.SourceTable.Severity = discretize(tableGPS.totale_casi,[10 50 1000 10000],...
'categorical', {'Low', 'Medium', 'High', 'Super High'});
gb.ColorVariable = 'Severity';
here is the output
Unable to resolve the name tableGPS.totale_casi.
Error in report_da_excel_M (line 213)
gb.SourceTable.Severity = discretize(tableGPS.totale_casi,[10 50 1000 10000],...
Must be something really stupid, but I am missing something ...
May someone be so kind to explain me what I am doing wrong?
Thanks

Antworten (1)

Walter Roberson
Walter Roberson am 24 Apr. 2020
gb.SourceTable.Severity = discretize(tableGPS.totale_casi,[10 50 1000 10000],...
'categorical', {'Low', 'Medium', 'High', 'Super High'});
gb.ColorVariable = 'Severity';
That uses a table named tableGPS but you have defined either tableGps or newGps .
You also have a problem with the discretize command: you hae four category names but only 3 bins. When you use discretize, the last numeric value is the end of the last bin, so there are one fewer bins than numeric values. If you want to express "10000 or up" then add an inf to the end of the list. And give a moment to consider what to do with values less than 10.
  2 Kommentare
Adriano Zanfei
Adriano Zanfei am 24 Apr. 2020
Sorry my fault: I was testing different tables and uncommented the wrong line...
websave('province_last.csv', 'https://raw.githubusercontent.com/pcm-dpc/COVID-19/master/dati-province/dpc-covid19-ita-province-latest.csv');
tableGps = readtable('province_last.csv');
tableGps = tableGps(~contains(tableGps.denominazione_provincia,'In fase di definizione/aggiornamento'),:);
figure()
gb = geobubble(tableGps,'lat','long','SizeVariable','totale_casi','Title','Mappa del contagio Covid-19: totale casi confermati');
gb.MapLayout = 'maximized'
gb.SourceTable.Severity = discretize(tableGPS.totale_casi,[10 50 1000 10000],...
'categorical', {'Low', 'Medium', 'High', 'Super High'});
gb.ColorVariable = 'Severity';
but the problem is stil there
Unable to resolve the name tableGPS.totale_casi.
I also noticed that the SourceTable seems to be deleted
>> head(gb.SourceTable, 5)
Invalid or deleted object.
Error in matlab.graphics.chart.GeographicBubbleChart/get.SourceTable
Thanks a lot for the tips on the bins...I did not realized it!
Walter Roberson
Walter Roberson am 24 Apr. 2020
gb.SourceTable.Severity = discretize(tableGPS.totale_casi,[10 50 1000 10000],...
look more closely at the name of the table being passed in!

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Geographic Plots finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by