gadmtools - graphics · 2021. 2. 11. · graphics functions function description choropleth...

28
GADMTools - Graphics [email protected] 2021-04-23 1

Upload: others

Post on 15-Feb-2021

3 views

Category:

Documents


0 download

TRANSCRIPT

  • GADMTools - [email protected]

    2021-04-23

    1

    mailto:[email protected]

  • Graphics

    functions

    Function Descriptionchoropleth Draws a choropleth on selected regionsclassDots Plots dots on a map with values between different fixed classesdots Plots dots on a mapdotDensity Draws a dot-density mapisopleth Draws an isopleth on selected regionsgadm_showNorth Displays a north arrow on a plotgadm_showScale Displays a scale on a plot

    2

  • Display a north arrow on a plot

    library(GADMTools)data("Corsica")

    plotmap(Corsica) %>% gadm_showNorth("tl")

    N

    41.5°N

    42°N

    42.5°N

    43°N

    8.6°E 8.8°E 9°E 9.2°E 9.4°E 9.6°E

    3

  • Display a scale on a plot

    library(GADMTools)data("Corsica")

    plotmap(Corsica) %>% gadm_showNorth("tl") %>% gadm_showScale("bl")

    N

    20 km

    41.5°N

    42°N

    42.5°N

    43°N

    8.6°E 8.8°E 9°E 9.2°E 9.4°E 9.6°E

    4

  • Plotting dots on a map

    # Preparing data.frame# --------------------data("Corsica")

    Corse

  • # Simple dots#--------------------------------------------------------------------dots(Corsica, DAT, color="red", size = 3)

    6

  • # Classified dots#--------------------------------------------------------------------dots(Corse, points = DAT,

    palette = "Reds",value="Cases")

    7

  • # Typed points#--------------------------------------------------------------------DAT2

  • Plotting proportionals dots

    # Test of propDots with default parameters# ------------------------------------------------------------------------------propDots(Corse,

    data = DAT,value="Cases",color = "blue")

    9

  • # Test of propDots with defined breaks# ------------------------------------------------------------------------------propDots(Corse,

    data = DAT,value="Cases", breaks=c(30, 40, 50, 70, 100),color = "blue")

    10

  • # Test of propDots with forced range of breaks# ------------------------------------------------------------------------------propDots(Corse, data = DAT, value="Cases",

    breaks=c(0, 25, 50, 75, 100),range = c(25, 100))

    11

  • Plotting dots with classified size

    library(GADMTools)

    classDots(Corse, DAT, color="blue", value = "Cases", steps = 4)

    12

  • Dot-Density

    library(GADMTools)data("Corsica")

    # Creates test data.frame -------------------------------------------------# --------------------------------------------------------------------------VAR_1

  • Plotting density

    library(GADMTools)

    isopleth(Corse, data = DAT, palette = "Blues")

    14

  • Plotting a choropleth

    DAT

  • fast.choropleth()

    fast.choropleth(

    x, data, value=NULL,

    breaks = NULL, steps = 5,

    adm.join=NULL, legend = NULL,

    labels = NULL,

    palette=NULL, title=""

    )

    Parameter Descriptionx Object GADMWrapperdata data.frame - data to plotvalue String - the name of the column in the data.frame we want to plot (eg: an incidence in

    epidemiology studies)breakssteps Integer - number of breaks. Default = 5. If breaks is NOT NULL this value is used

    internally with cut().adm.join String - the name in GADM spdf dataset which will be joined with a column of the data.legend String - legend title. Default NULL.labels String vector labels for the legend. Default NULLpalette String - An RColorBrewer palette name or a String vector vector of colors. Default NULL.title String - Title of the plot. Default is an empty string.

    16

  • Example

    MAP

  • 41.5°N

    42°N

    42.5°N

    43°N

    8.6°E 8.8°E 9°E 9.2°E 9.4°E 9.6°E

    Figure 1: Simple dots

    18

  • 41.5°N

    42°N

    42.5°N

    43°N

    8.6°E 8.8°E 9°E 9.2°E 9.4°E 9.6°E

    (62.6,69]

    (56.2,62.6]

    (49.8,56.2]

    (43.4,49.8]

    (37,43.4]

    Figure 2: Classified dots

    19

  • 41.5°N

    42°N

    42.5°N

    43°N

    8.6°E 8.8°E 9°E 9.2°E 9.4°E 9.6°E

    STRATE

    TYPE A

    TYPE B

    TYPE C

    Figure 3: Typed dots

    20

  • Figure 4: propDots

    21

  • Cases

    40

    50

    Figure 5: propDots with provided breaks

    22

  • Cases

    25

    50

    75

    100

    Figure 6: propDots

    23

  • (61,69]

    (53,61](45,53](37,45]

    Figure 7: classDots

    24

  • 1 dot = 1000 cases

    H1N1

    H1N2

    H2N2

    Figure 8: Dot-Density

    25

  • 1

    2

    3

    4

    5

    Figure 9: Isopleth

    26

  • Pop

    (2.32e+04,2.45e+04]

    (2.2e+04,2.32e+04]

    (2.07e+04,2.2e+04]

    (1.95e+04,2.07e+04]

    (1.83e+04,1.95e+04]

    (1.7e+04,1.83e+04]

    (1.58e+04,1.7e+04]

    (1.45e+04,1.58e+04]

    Figure 10: Choropleth

    27

  • Figure 11: drawing a fast.choropleth

    28

    GraphicsfunctionsDisplay a north arrow on a plotDisplay a scale on a plotPlotting dots on a mapPlotting proportionals dotsPlotting dots with classified sizeDot-DensityPlotting densityPlotting a choroplethfast.choropleth()Example