Review of esviz functions that use 'ColorBarContinuous()'
This issue is to help keep track of the lower boundary exclusion issue "(, ]" in the esviz functions that use ColorBarContinuous() (see issue #15). The solution in branch dev-ColorBar_boundaries has been to create the parameters include_lower_boundary and include_upper_boundary, which allow users to set inclusion/exclusion of the lower and upper limits (see !26).
-
R/VizEquiMap.R: has exclusion problem, now includes include_lower_boundaryandinclude_upper_boundary -
R/VizLayout.R:
Code
library(devtools); devtools::load_all()
source("R/VizEquiMap.R")
ano <- s2dv::Ano_CrossValid(map_temp$exp, map_temp$obs, memb = FALSE,
dat_dim = c('dat', 'member'), memb_dim = 'member')
var <- s2dv::MeanDims(ano$exp, "member")
lats <- attr(map_temp$exp, "Variables")$common$lat
lons <- attr(map_temp$exp, "Variables")$common$lon
png("VizLayout.png")
VizLayout(fun = VizEquiMap, plot_dims = c('lat', 'lon'),
var = var[, 1, 1, 1, , ], lon = lons, lat = lats,
filled.continents = FALSE,
toptitle = 'Near-surface temperature Nov.',
titles = paste(2000:2005))
dev.off()
# Example like in issue #15. So far so good...
set.seed(0)
data <- array(rep(0:10, each = 120),dim = c(lat = 30, lon = 44))
range(data)
# [1] 0 10
lons <- -10:33
lats <- 31:60
cols_white_red <- s2dv::clim.palette("bluered")(41)[21:41]
png("VizLayout_AnChi.png")
VizLayout(fun = VizEquiMap, plot_dims = c('lat', 'lon'),
var = data, lon = lons, lat = lats,
filled.continents = FALSE,
toptitle = 'Near-surface temperature Nov.',
titles = paste(2000:2005))
dev.off()
-
R/VizMatrix.R:
Code
```r # The function's examplepng("VizMatrix_ex2.png") esviz:::VizMatrix(var = matrix(rnorm(n = 120, mean = 0.4), 10, 12), cols = c('white','lightblue','red','darkblue','darkgreen', 'green','#b30000', '#7f0000'), brks = c(-1, 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 1), toptitle = "Mean Absolute Error", xtitle = "Forecast time (month)", ytitle = "Start date", xlabels = c("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")) dev.off()
</details>
{width=20%}
{width=20%}
- [x] R/VizRobinson.R: observation: the longitude in the european map seems to go beyond the lons value):
<details><summary>Code</summary>
```r
data <- array(rep(seq(-10, 10, length.out = 181), 360) + rnorm(360),
dim = c(lat = 181, lon = 360))
dots <- data
dots[which(dots < 4 & dots > -4)] <- 0
dots[which(dots != 0)] <- 1
png("VizRobinson_ex.png")
VizRobinson(data, lon = 0:359, lat = -90:90, dots = dots,
brks = seq(-10, 10, length.out = 11),
toptitle = 'synthetic example', vertical = FALSE,
caption = 'Robinson Projection',
bar_extra_margin = c(0, 1, 0, 1), width = 8, height = 6)
dev.off()
png("VizRobinson_ex2.png")
VizRobinson(data, lon = 0:359, lat = -90:90, mask = dots, drawleg = 'ggplot2',
target_proj = "+proj=moll", brks = seq(-10, 10, length.out = 11),
color_fun = ClimPalette("purpleorange"), colNA = 'green',
toptitle = 'synthetic example', caption = 'Mollweide Projection',
width = 8, height = 6)
dev.off()
set.seed(0)
data <- array(rep(0:10, each = 120),dim = c(lat = 30, lon = 44))
range(data)
lons <- -10:33
lats <- 31:60
cols_white_red <- s2dv::clim.palette("bluered")(41)[21:41]
png("VizRobinson_AnChi.png")
VizRobinson(data, lon = lons, lat = lats)
dev.off()
-
R/VizScorecard.R: the second image shows cells that have value 1.00 as colored, unlike Núria's comment in #15. Beside the point, there are correlations >1. Should they include a warning? I just modified the example in the function from rnorm(1000) to rnorm(1000, 1, 0.1).
Click to expand
data <- array(rnorm(1000), dim = c('sdate' = 12, 'metric' = 4, 'region' = 3,
'time' = 6))
row_names <- c('Tropics', 'Extra-tropical NH', 'Extra-tropical SH')
col_names <- c('Mean bias (K)', 'Correlation', 'RPSS','CRPSS')
png("VizScorecard_ex.png")
VizScorecard(data = data, row_names = row_names, col_names = col_names,
subcol_names = month.abb[as.numeric(1:12)],
row_title = 'Region', subrow_title = 'Forecast Month',
col_title = 'Start date',
table_title = "Temperature of ECMWF System 5",
table_subtitle = "(Ref: ERA5 1994-2016)",
fileout = 'VizScorecard_ex1.png')
dev.off()
data <- array(rnorm(1000, 1, 0.1), dim = c('sdate' = 12, 'metric' = 4, 'region' = 3,
'time' = 6))
VizScorecard(data = data, row_names = row_names, col_names = col_names,
subcol_names = month.abb[as.numeric(1:12)],
row_title = 'Region', subrow_title = 'Forecast Month',
col_title = 'Start date',
table_title = "Temperature of ECMWF System 5",
table_subtitle = "(Ref: ERA5 1994-2016)",
fileout = 'VizScorecard_ex2.png')
-
R/VizStereoMap.R -
R/VizTriangles4Categories.R
To check/update: R/zzz.R, man/ClimPalette.Rd, man/ColorBarContinuous.Rd (Generated by roxygen2)
Feel free to add any more functions I may have missed.
Ariadna






