Description Usage Arguments Value Author(s) See Also Examples
This function allows to prepare a grid of clusters (included in 'time' dimension) for plotting. A subset of a variable and/or member is also performed in multimember or multigrid objects.
1 | cluster2plot(cluster, members = 1, var = getVarNames(cluster)[1])
|
cluster |
A grid (gridded or station dataset), multigrid, multimember grid or multimember multigrid object, as
returned by |
members |
(optional) Integer value indicating the position of the member to be subset. Default: 1. If input grid has no member dimension, this argument is ignored. |
var |
(optional) Character vector indicating the variable name to be extracted. Default: first variable. See subsetGrid. |
A new C4R grid object that contains the clusters from the specified variable and/or member.
This subset grid of clusters is ready to be plotted with C4R plotting tools, e.g. spatialPlot
, since clusters are intrepreted as variables (see makeMultiGrid).
J. A. Fernandez
makeMultiGrid, subsetGrid, subsetDimension.
1 2 3 4 5 6 7 8 9 10 11 | #Example 1: 'cluster' is a 3D grid of clusters.
data(NCEP_Iberia_psl, package = "transformeR")
clusters<- clusterGrid(NCEP_Iberia_psl, type="kmeans", centers=10)
mg <- cluster2plot(clusters)
spatialPlot(mg, backdrop.theme = "coastline", rev.colors = T, layout = c(2,ceiling(attr(clusters, "centers")/2)), as.table=TRUE)
Example 2: 'cluster' is a grid of clusters with two variables (same for members).
data(NCEP_Iberia_ta850, package = "transformeR")
clusters<- clusterGrid(makeMultiGrid(NCEP_Iberia_psl, NCEP_Iberia_ta850), type="kmeans", centers=10, iter.max=1000)
mg <- cluster2plot(clusters, members=1, var="psl") #To obtain first member and variable called "psl"
spatialPlot(mg, backdrop.theme = "coastline", rev.colors = T, layout = c(2,ceiling(attr(clusters, "centers")/2)), as.table=TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.