horizonplot-methods | R Documentation |
This method draws horizon graphs for each zone as
calculated with zonal
from the directions defined by
xyLayer
## S4 method for signature 'RasterStackBrick,missing'
horizonplot(x, data = NULL,
dirXY = y, stat = 'mean', digits = 0,
origin = mean,
xlab = 'Time', ylab = 'direction',
colorkey = TRUE, colorkey.digits = 1,
scales=list(y = list(relation = "same")),
...)
## S4 method for signature 'SpatRaster,missing'
horizonplot(x, data = NULL,
dirXY = y, stat = 'mean', digits = 0,
origin = mean,
xlab = 'Time', ylab = 'direction',
colorkey = TRUE, colorkey.digits = 1,
scales=list(y = list(relation = "same")),
...)
x |
A |
data |
Not used. |
dirXY |
A direction as a function of the coordinates (see
|
stat |
a function to be applied to summarize the values by
zone. See |
digits |
An integer, number of digits for |
origin |
From the |
xlab, ylab |
Labels of the axis. |
colorkey |
If |
colorkey.digits |
Digits for rounding values in |
scales |
From the |
... |
Additional arguments for the |
(Extracted from the reference): "The horizon graph allows to examine how a large number of items changed through time, to spot extraordinary behaviors and predominant patterns, view each of the items independently from the others when they wish, make comparisons between the items, and view changes that occurred with enough precision to determine if further examination is required."
http://vis.berkeley.edu/papers/horizon/2009-TimeSeries-CHI.pdf
horizonplot
,
xyplot
, levelplot
.
## Not run:
library(raster)
library(terra)
library(zoo)
url <- "ftp://ftp.wiley.com/public/sci_tech_med/spatio_temporal_data/"
sst.dat = read.table(paste(url, "SST011970_032003.dat", sep=''), header = FALSE)
sst.ll = read.table(paste(url, "SSTlonlat.dat", sep=''), header = FALSE)
spSST <- SpatialPointsDataFrame(sst.ll, sst.dat)
gridded(spSST) <- TRUE
proj4string(spSST) = "+proj=longlat +datum=WGS84"
SST <- brick(spSST)
idx <- seq(as.Date('1970-01-01'), as.Date('2003-03-01'), by='month')
idx <- as.yearmon(idx)
SST <- setZ(SST, idx)
names(SST) <- as.character(idx)
horizonplot(SST)
horizonplot(SST, stat='sd')
## Different scales for each panel, with colors representing deviations
## from the origin in *that* panel
horizonplot(SST, scales=list('free'))
## origin may be a function...
horizonplot(SST, origin=mean)
## ...or a number
horizonplot(SST, origin=0)
## A different color palette
pal <- RColorBrewer::brewer.pal(n=6, 'PuOr')
horizonplot(SST, origin = 0, col.regions = pal)
## The width of each color segment can be defined with horizonscale
horizonplot(SST, horizonscale=1, origin=0)
## End(Not run)
## Not run:
dataURL <- "https://raw.github.com/oscarperpinan/bookvis/master/data/"
##Solar irradiation data from CMSAF http://dx.doi.org/10.5676/EUM_SAF_CM/RAD_MVIRI/V001
old <- setwd(tempdir())
download.file(paste0(dataURL, "SISmm2008_CMSAF.zip"),
"SISmm2008_CMSAF.zip", method='wget')
unzip("SISmm2008_CMSAF.zip")
listFich <- dir(pattern='\\.nc')
stackSIS <- stack(listFich)
stackSIS <- stackSIS*24 ##from irradiance (W/m2) to irradiation Wh/m2
setwd(old)
idx <- seq(as.Date('2008-01-15'), as.Date('2008-12-15'), 'month')
SISmm <- setZ(stackSIS, idx)
names(SISmm) <- month.abb
horizonplot(SISmm)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.