plotFlowbased: Plot flow-based domain(s)

View source: R/graphs.R

plotFlowbasedR Documentation

Plot flow-based domain(s)

Description

Plot flow-based domain(s)

Usage

plotFlowbased(
  PLAN,
  PLAN2 = NULL,
  VERT = NULL,
  VERT2 = NULL,
  country1,
  country2,
  hours,
  dates,
  hours2 = NULL,
  dates2 = NULL,
  domainsNames = NULL,
  hubDrop = list(NL = c("BE", "DE", "FR", "AT")),
  hubDrop2 = NULL,
  xlim = c(-10000, 10000),
  ylim = c(-10000, 10000),
  main = NULL,
  width = "420px",
  height = "410px",
  color = NULL,
  export = F
)

Arguments

PLAN

data.table, at least ram, Date, Period and two ptdf columns :

  • ptdfAT : autrichian vertices

  • ptdfBE : belgium vertices

  • ptdfDE : german vertices

  • ptdfFR : french vertices

  • ram : line limits

  • Date : date in format YYYY-MM-DD

  • Period : hour in the day, between 1 and 24

PLAN is generated in this format with the function getPreprocPlan

PLAN2

data.table, at least ram, Date, Period and two ptdf columns. This argument is optional, default is NULL. You can use it if you want to make comparison between domains from cwe and domains from cwe-at.

VERT

data.table, Vertices of PLAN. If set to NULL, vertices will be calculated within the function.

VERT2

data.table, Vertices of PLAN2. If set to NULL, vertices will be calculated within the function.

country1

character, name of the country whose net position is in the x axis (BE, FR, DE, AT or NL)

country2

character, name of the country whose net position is in the y axis (BE, FR, DE, AT or NL)

hours

character, hours of interest for the graphics.

dates

character, dates of interest for the graphics.

hours2

character, optional (default NULL) hours of interest for the graphics of the domains from PLAN2.

dates2

character, optional (default NULL) dates of interest for the graphics. of the domains from PLAN2.

domainsNames

character names of the domain(s), used as legend of the graphics. The length of domainsNames has to be the same of the number of combinations of hours and dates

hubDrop

list, list of hubs in the ptdf, with the ones which should sustracted to the others as the names of the arrays which themself contain the ones which be sustracted

hubDrop2

list, optional (default NULL) list of hubs in the ptdf from PLAN2, with the ones which should sustracted to the others as the names of the arrays which themself contain the ones which be sustracted

xlim

numeric, limits of x-axis (default = c(-10000, 10000))

ylim

numeric, limits of x-axis (default = c(-10000, 10000))

main

character title of the graph, if NULL, the title will be "Domains country1 - country2"

width

character, for rAmCharts only. Default to "420px" (set to "100/100" for dynamic resize)

height

character, for rAmCharts only. Default to "410px" (set to "100/100" for dynamic resize)

color

character, default NULL, if you want to customize the colors of the graphics, color has to be the same length as the number of graphics you want. The colors can be written either in the format "red", "blue"... or "#CC0000", "#00CC00"...

export

logical If you want to have the possibility to export your graphic (if true in rmarkdown, can return a blank html)

Examples


## Not run: 
library(data.table)
library(rAmCharts)
PLAN <- getPreprocPlan(
pathPtdfMatrixFactor = system.file(
  "testdata/plan_new_version_factor_AT.rds", package = "fbClust"),
pathPtdfMatrixConstraint = system.file(
 "testdata/plan_new_version_constraint_AT.rds", package = "fbClust"))
 
 hubDrop = list(NL = c("BE", "DE", "FR", "AT"))
#Plot unique polyhedron
plotFlowbased(PLAN, country1 = "BE", country2 = "DE", hubDrop = hubDrop, 
hours = c(2), dates = c("2018-10-02"), domainsNames = "2018-10-02", main = "")

#Plot four polyhedra
plotFlowbased(PLAN, country1 = "BE", country2 = "DE", hubDrop = hubDrop, 
hours = c(3, 4), dates = c("2018-10-02", "2018-10-04"), domainsNames = NULL,
main = NULL)


#Plot two domains from cwe_at and one domain from cwe in the same graphic
 PLAN2 <- copy(PLAN)
 PLAN2 <- PLAN2[Date == "2018-10-04"]
 PLAN2[, ptdfAT := NULL]
 hubDrop2 <- list("NL" = list("BE", "DE", "FR"))
 plotFlowbased(PLAN, PLAN2 = PLAN2, country1 = "BE", country2 = "DE", 
                       hubDrop = hubDrop, hubDrop2 = hubDrop2,
                       hours = c(3, 4), dates = c("2018-10-02"),
                       hours2 = c(4), dates2 = c("2018-10-04"),
                       domainsNames = NULL, main = NULL)



 # Plot two domains from cwe and cwe-at at the same hours 
 PLAN3 <- copy(PLAN)
 PLAN3[, ptdfAT := NULL]
 hubDrop2 <- list("NL" = list("BE", "DE", "FR"))
 plotFlowbased(PLAN, PLAN2 = PLAN3, country1 = "BE", country2 = "DE", 
                       hubDrop = hubDrop, hubDrop2 = hubDrop2,
                       hours = c(3, 4), dates = c("2018-10-02"),
                       hours2 = c(3, 4), dates2 = c("2018-10-02"),
                       domainsNames = NULL, main = NULL)
                       
                       
 # Examples with colors chosen
 plotFlowbased(PLAN, country1 = "AT", country2 = "DE", 
                       hubDrop = hubDrop,
                       hours = c(3), dates = c("2018-10-02", "2018-10-03"),
                       domainsNames = NULL, main = NULL,
                       color = c("#CC0000", "purple"))
                       
                           
 plotFlowbased(PLAN, PLAN2 = PLAN3, country1 = "BE", country2 = "DE", 
                       hubDrop = hubDrop, hubDrop2 = hubDrop2,
                       hours = c(3, 4), dates = c("2018-10-02"),
                       hours2 = c(3, 4), dates2 = c("2018-10-02"),
                       domainsNames = NULL, main = NULL,
                       color = c("blue", "grey", "green", "brown"))                      


## End(Not run)


rte-antares-rpackage/fbClust documentation built on July 4, 2023, 12:06 a.m.