pie_map: Create a pie map

Description Usage Arguments Details Author(s) See Also Examples

View source: R/pie_map.R

Description

This function ouputs a pie map from the dataset provided as input

Usage

1
2
3
pie_map(con, df_input, dimension_group_by = NULL, df_spatial_code_list_name,
  area_filter_wkt = NULL, number_of_classes = 1, function_pie_size = NULL,
  bounding_box = NULL)

Arguments

con

a wrapper of rpostgresql connection (connection to a database)

df_input

data.frame to map

dimension_group_by

string. Name of the dimension that will be the classes in the pies or NULL if no aggregation dimension.

df_spatial_code_list_name

string. Name of the spatial coding system used in df_input (column 'geographic_identifier')

area_filter_wkt

sting. A spatial filter (WKT format) or NULL if no spatial filter.

number_of_classes

integer. Number of classes to visualize in the pies.

function_pie_size

string. square_root, square, proportional, unique

bounding_box

vector of bounding box for vizualisation (c(xmîn,xmax,ymin,ymax))

Details

All values in df_input must be expressed with the same unit (since the function aggregates the data).

Column of spatial codes must be named 'geographic_identifier'.

Author(s)

Paul Taconet, paul.taconet@ird.fr

See Also

Other visualize data: functions_visualize_data, time_series_plot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
# Connect to Tuna atlas database
con<-db_connection_tunaatlas_world()

# Extract IOTC (Indian Ocean) georeferenced catch time series of catches from Sardara DB, in 5° resolution
ind_catch_tunaatlasird_level2<-extract_dataset(con,list_metadata_datasets(con,identifier="indian_ocean_catch_5deg_1m_1952_11_01_2016_01_01_tunaatlasIRD_level2"))
head(ind_catch_tunaatlasird_level2)

# filter the data to keep only catches on log schools in 2014:
ind_catch_tunaatlasird_level2 <- ind_catch_tunaatlasird_level2 %>% filter (year==2014) %>% filter (schooltype=="LS")

# Map the catches made on log schools in 2014 by species:
pie_map(con,
      df_input=ind_catch_tunaatlasird_level2,
      dimension_group_by="species",
      df_spatial_code_list_name="areas_tuna_rfmos_task2",
      number_of_classes=4 
     )
     
dbDisconnect(con)

ptaconet/rtunaatlas documentation built on Sept. 21, 2021, 10:43 p.m.