Learn R Programming

msaFACE (version 0.1.0)

plot.MSA_coef: Plot function for moving subset analysis

Description

Create main or accompanying plot(s) of the moving subset analysis

Usage

"plot"(x, i_var = 1:length(x), main_plot = TRUE, i_acc = 1, axis.param = list(), label.param = list(), ...)

Arguments

x
Object of class MSA_coef. Output of moving_subset_analysis.
i_var
Column number or name of the forcing variable used to define the subset which will be plotted. Default is to plot all available variables.
main_plot
Flag to determine whether to plot the main plot(s) (default) or the accompanying plot(s)
i_acc
If main_plot = FALSE, column number(s) of the experiment-support variable(s) to be plotted as accompanying variable(s)
axis.param
List containing the axis parameters (e.g. lty, col, tck). By default for main plots, first entry represents x-axis (forcing variable), second entry represents first y-axis (regression result), and third entry the second y-axis (dependent variable). See example section.
label.param
List containing the label parameters (e.g. line, cex). For order of the list refer to axis.param. See example section.
...
Parameters passed to generic plot function

See Also

moving_subset_analysis, GiFACE, summary.MSA_coef

Examples

Run this code
data(GiFACE)

### Perform Moving Subset Analysis
msa_data <- moving_subset_analysis(GiFACE$data, "CO2A_Mean", "BYT", 30, group = GiFACE$year)

## Plot all final plots
plot(msa_data)

## Not run: 
# ## Example to produce similar plots as in article
# pdf("Plot_NCC_1.pdf", width = 15, height = 20)
# par(mfcol = c(9,4), mar = c(4,4,1,4), las = 0)
# for(i in 1:4){
#   plot(msa_data, i_var = i, ylim = list(c(0,2.5), c(200,350)), 
#        legend = i == 1)
#   plot(msa_data, i_var = i, main_plot = F, i_acc = 1:8)
# }
# dev.off()
# ## End(Not run)

## Not run: 
# ## Example to adjust axis and label parameters
# par(mar = c(3.2,3.5,1,3), mfrow = c(2,1))
# ## Plot default for comparison
# plot(msa_data, i_var = 2)     
# 
# ## Change default axis (all parameters are passed to internal function "axis")
# ## Define x-axis specifications
# xaxt_spec  <- list(tck = -0.02, padj = -0.3, cex.axis = 1.5, lwd = 2)
# ## Define 1st y-axis specifications 
# yaxt1_spec <- list(at = c(0,1,2), tck = -0.02, padj = 0.5, cex.axis = 1.5, lwd = 2)
# ## Define 2nd y-axis specifications 
# yaxt2_spec <- list(tck = -0.02, padj = -0.3, col = "gray50", col.axis = "gray50",
#                    cex.axis = 1.5, lwd = 2)
# 
# ## Change default labeling (all parameters are passed to internal function "mtext")
# ## Define x-axis label specifications 
# xlab_spec <- list(side = 1, line = 2, cex = 1.5)
# ## Define 1st y-axis label specifications
# ylab1_spec <- list(side = 2, line = 2, cex = 1.5)
# ## Define 2nd y-axis label specifications 
# ylab2_spec <- list(side = 4, line = 2, cex = 1.5, col = "gray50")
#                    
#                    
# ## Define variable to be plotted, y-axis limits
# plot(msa_data, i_var = 2, ylim = list(c(0,2.5), c(200,350)),                                     
#      axis.param = list(xaxt_spec, yaxt1_spec, yaxt2_spec),
#      label.param = list(xlab_spec, ylab1_spec, ylab2_spec),
#      ## Define line width for horizontal lines (1) and the dependent variable (2)
#      lwd = c(1,2),       
#      ## Define point symbol
#      pch = 20)                                                                                   
# dev.off()
# ## End(Not run)

Run the code above in your browser using DataLab