PlotLayout errors
Hi @nperez ,
I'm trying to make a plot with multiple subplots using PlotLayout. My data is a list containing 3 lists (see attached image with the content of the list).
I want to make a plot that shows the R score of each metric, and I've tried 3 ways:
s2dv::PlotLayout(fun = PlotEquiMap,plot_dims = c("lat", "lon"),
var = list(drop(metricsacc_raw_r),drop(metrics
acc_bias_r),drop(metricsmetrics
acc_crps_r),
drop(metricsmetrics
acc_evmos_r),drop(metricsmetrics
acc_mse_min_r),drop(metricsmetrics
acc_rpc_based_r)),
lon = metricslon,lat = metrics
lat,
titles = c("raw","Simple bias correction","crps","evmos","mse_min","rpc-based"),
brks = seq(-1,1,0.1),fileout="multipanel_calibration.png") # multipanel
I'm using "drop" before calling each element of the list because they have 2 empty dimensions before lat and lon, and I was having issues because the dimensions in var should be the same as in "plot_dims". This is the error I get:
Error in if (!all(sapply(var, is.array) | sapply(var, is_single_na))) {: missing value where TRUE/FALSE needed Traceback:
- s2dv::PlotLayout(fun = PlotEquiMap, plot_dims = c("lat", "lon"),
. var = list(drop(metrics
acc_raw_r), drop(metrics
acc_bias_r), . drop(metricsmetrics
acc_crps_r), drop(metricsmetrics
acc_evmos_r), . drop(metricsmetrics
acc_mse_min_r), drop(metricsmetrics
acc_rpc_based_r)), . lon = metricslon, lat = metrics
lat, titles = c("raw", "Simple bias correction", . "crps", "evmos", "mse_min", "rpc-based"), brks = seq(-1, . 1, 0.1), fileout = "multipanel_calibration.png")
Second way:
s2dv::PlotLayout(fun = PlotEquiMap,plot_dims = c("lat", "lon"), var = metrics$metrics,lon = metrics$lon,lat = metrics$lat, brks = seq(-1,1,0.1),fileout="multipanel_calibration.png") # multipanel
I get this error = Error in s2dv::PlotLayout(fun = PlotEquiMap, plot_dims = c("lat", "lon"), : All arrays provided in parameter 'var' must have all the dimensions in 'plot_dims'.
Third way: Here I specify that I just want the elements 1,3,5,7,9 and 11 of metrics
metrics. I added "drop" but the error without it is the same:
PlotLayout(PlotEquiMap,plot_dims = c("lat", "lon"), var = drop(metrics$metrics[c(1,3,5,7,9,11)]), lon = metrics$lon,lat = metrics$lat, titles = c("raw","Simple bias correction","crps","evmos","mse_min","rpc-based"), brks = seq(-1,1,0.1),fileout="multipanel_calibration.png") # multipanel
And the error: Error in PlotLayout(PlotEquiMap, plot_dims = c("lat", "lon"), var = drop(metrics$metrics[c(1, : All arrays provided in parameter 'var' must have all the dimensions in 'plot_dims'.
The file I'm reading is '/home/Earth/ptrascas/result_file.rds'
Could you please help me with this plotting issue?
Many thanks,
Paloma