These functions get and set options that control some graphical aspects of maps created with [plotMap()].
plotMapOptions(
areaDefaultCol = "#DDDDE5",
areaDefaultSize = 30,
areaMaxSize = 50,
areaMaxHeight = 50,
areaChartColors = NULL,
areaColorScaleOpts = colorScaleOptions(),
labelMinSize = 8,
labelMaxSize = 24,
linkDefaultCol = "#BEBECE",
linkDefaultSize = 3,
linkMaxSize = 15,
linkColorScaleOpts = colorScaleOptions(),
legend = c("choose", "visible", "hidden"),
tilesURL = defaultTilesURL(),
preprocess = function(map) {
map
}
)
defaultTilesURL()
colorScaleOptions(
breaks = 5,
domain = NULL,
negCol = "#FF0000",
zeroCol = "#FAFAFA",
posCol = "#0000FF",
naCol = "#EEEEEE",
zeroTol = NULL,
colors = NULL,
levels = NULL
)
default color of areas.
default size of areas.
maximal size of an area when it represents the value of some variable.
Maximal height of bars. Used only if a barchart representation is used.
Vector of colors to use in polar area charts and bar charts
List of options used to construct a continuous color scale. This list should
be generated with function colorScaleOptions
.
minimal height of labels.
maximal height of labels.
Default color of links.
Default line width of links.
Maximal line width of a link when it represents the value of some variable.
List of options used to construct a continuous color scale. This list should
be generated with function colorScaleOptions
.
Should the legend be displayed or not ? Default is to mask the legend but add a button to display it. Other values are "visible" to make the legend always visible and "hidden" to mask it.
URL template used to get map tiles. The followign site provides some URLs; https://leaflet-extras.github.io/leaflet-providers/preview/
A function that takes as argument a map and that returns a modified version of this map. This parameter can be used to add extra information on a map.
Either a single number indicating the approximate number of colors to use, or a vector of values at which values to change color. In the first case, the function tries to cut the data nicely, so the real number of colors used may vary.
Range of the data, ie. the range of possible values. If NULL
, the
the range of the data is used
color of the extreme negative value.
color of the 0 value.
Color of the extreme positive value.
Color for missing values
All values in the interval \[-zeroTol, +zeroTol\]
are mapped to the
zeroCol
color. If NULL
, the function tries to pick a nice
value that is approximately equal to 1% of the maximal value.
Vector of colors. If it is set and if user manually sets break points, then these colors are used instead of the colors defined by parameters negCol, zeroCol and posCol.
Vector of the distinct values a variable can take. Only used when the variable to represent is a categorical variable.
A list with the values of the different graphical parameters.
if (FALSE) {
# Example : Change color for area variables
library(antaresViz)
studyPath <- "path/to/study"
setSimulationPath(path = studyPath, simulation = -1)
myData<-readAntares(areas = "all", links = "all")
ml<-readRDS(file = "path/to/mapLayout.rds")
myOption<-plotMapOptions(areaChartColors = c("yellow", "violetred"))
plotMap(myData,
ml,
sizeAreaVars = c("SOLAR", "WIND"),
type="avg",
interactive = FALSE,
options = myOption
)
# for pie chart
plotMap(myData,
ml,
sizeAreaVars = c("SOLAR", "WIND"),
type="avg",
interactive = FALSE,
options = myOption,
areaChartType = "pie",
sizeMiniPlot = TRUE
)
# Example : Change color for link and area variables
myOption <- plotMapOptions(areaChartColors = c("yellow", "violetred"), linkDefaultCol = "green")
plotMap(myData,
ml,
type="avg",
sizeAreaVars = c("SOLAR", "WIND"),
interactive = FALSE,
options = myOption
)
# Change default area color
myOption <- plotMapOptions(areaDefaultCol = "green")
plotMap(myData,
ml,
interactive = FALSE,
options = myOption
)
# Change the scale
plotMap(myData,
ml,
colAreaVar = "MRG. PRICE",
options = plotMapOptions(
areaColorScaleOpts = colorScaleOptions(
breaks = c(-1000, 100, 200, 20000),
colors = c("green", "orange", "red")
)
),
interactive = FALSE
)
}