From 29b1f1beb9903cc8c48a87e1fd1f5c1a2fea9e21 Mon Sep 17 00:00:00 2001 From: Michal_Lelonek Date: Tue, 14 Dec 2021 16:03:58 +0100 Subject: [PATCH] Update 'Geomap_function_4.m' --- Geomap_function_4.m | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 60 insertions(+), 3 deletions(-) diff --git a/Geomap_function_4.m b/Geomap_function_4.m index 35eebe7..ca84af7 100644 --- a/Geomap_function_4.m +++ b/Geomap_function_4.m @@ -1,8 +1,65 @@ %% This function was automatically generated. When modifying its signature, take care to apply %% modifications also to the descriptor files in the repository. -function Geomap_function_4(Catalog, MAGNITUDE BIN 1, MAGNITUDE BIN 1) - -%% GEOMAP_FUNCTION_4 +%% function Geomap_function(Catalog) +function Figure1 = Geomap_function_4(Catalog, BIN1, BIN2) +%% GEOMAP_FUNCTION %% TODO: Put your application code here +% Visualization of events on a Geomap +% by ML 14 Dec 2021 +%close all; clc + + +% Set interpreters to correctly display underscore symbols +set(0, 'DefaultTextInterpreter', 'none') +set(0, 'DefaultLegendInterpreter', 'none') +set(0, 'DefaultAxesTickLabelInterpreter', 'none') + +% Load catalog and strip the file name +%[baseFileName, folder] = uigetfile('*.mat'); +%fullFileName = fullfile(folder, baseFileName); +%load(fullFileName); +%chart_title=baseFileName(1:end-4); + +% Extraction of longitude and latitude from the Catalog +lat=Catalog(strcmp('Lat',{Catalog.field})).val; +long=Catalog(strcmp('Long',{Catalog.field})).val; + +% Extraction of magnitude from the Catalog which type recognition +if sum((strcmp('ML',{Catalog.field})))==1 + Magn=Catalog(strcmp('ML',{Catalog.field})).val; +else + Magn=Catalog(strcmp('Mw',{Catalog.field})).val; +end + +% Assignment of categories to magnitude data +%a=1; +%b=2; +atext=num2str(BIN1); +btext=num2str(BIN2); +below='<'; +above='>'; +between='-'; +bin1label=append(below, atext); +bin2label=append(atext, between, btext); +bin3label=append(above, btext); +Category = discretize(Magn,[-100 BIN1 BIN2 100],'categorical', {bin1label, bin2label, bin3label}); + +% Assignment of categories' colors (first category in first row, etc.) in RGB standard +color_RGB=[0.1 1.0 0.3;... + 0.8 0.8 0.2;... + 1.0 0.0 0.0]; + +% Drawing a Geomap +gb=geobubble(lat, long, Magn, Category,... + 'Basemap', 'streets',... + 'BubbleColorList', color_RGB,... + 'ColorLegendTitle', 'Magnitude category',... + 'SizeLegendTitle', 'Event magnitude',... + 'GridVisible', 'on',... + 'ScalebarVisible', 'on'); +gb.BubbleWidthRange = [1 20]; +%title(chart_title); +%Figure1 = ancestor(gb, 'figure'); +saveas(gcf,'Figure1','png'); end