macroPlot | R Documentation |
Plot time series from SOIL or MACRO simulation data (input or output). When
x
is missing and/or gui
is FALSE
, the function pops-up
menu asking the user which file(s) and which variable(s) to plot, and how.
macroPlot(x, ...)
## S3 method for class 'macroTimeSeries'
macroPlot(x, ...)
## S3 method for class 'macroTimeSeriesList'
macroPlot(x, ...)
## S3 method for class 'data.frame'
macroPlot(x, ...)
## Default S3 method:
macroPlot(
x,
gui = TRUE,
z = NULL,
subPlots = TRUE,
verbose = TRUE,
xlab = "Date",
ylab = NULL,
ylim = NULL,
xlim = NULL,
col = NULL,
sub = NULL,
lwd = 2L,
lty = NULL,
main = NULL,
cex.main = NULL,
panel.first = .paf(),
dLegend = TRUE,
las = 1L,
bty = "n",
...
)
x |
A single |
... |
Additional arguments passed to |
gui |
Single logical. Set to |
z |
Vector of character strings. Name of the variables to include
in the graph. If |
subPlots |
Single logical. If |
verbose |
Single logical. If |
xlab |
See |
ylab |
See |
ylim |
See |
xlim |
See |
col |
See |
sub |
See |
lwd |
See |
lty |
See |
main |
See |
cex.main |
See |
panel.first |
See |
dLegend |
Single logical value. If |
las |
See |
bty |
See |
Invisibly returns 'x', or the content of the files selected.
library( "macroutils2" )
# ====== Example 1: MACRO model input file ======
# Path to the file to be read
( filenm <- system.file( c(
"bintest/chat_winCer_GW-D_1kgHa_d298_annual_output.bin",
"bintest/chat_pot_GW-D_1kgHa_d119_biennial_output.bin" ),
package = "macroutils2",
mustWork = TRUE
) )
# Read these 2 files
out1 <- macroReadBin( f = filenm[ 1 ] )
out2 <- macroReadBin( f = filenm[ 2 ] )
# Inspect the data:
head( out1 ); dim( out1 )
head( out2 ); dim( out2 )
# Shorten the 2nd file to the same length as the 1st
out2 <- out2[ out2[, "Date" ] %in% out1[, "Date" ], ]
# ====== Plot the data ======
# With sub-plots
macroPlot( x = out1[, 1:4 ], gui = FALSE )
# In one plot (not so meaningful in this case!)
macroPlot( x = out1[, 1:4 ], gui = FALSE, subPlots = FALSE )
# Plot Multiple tables at once
# Format a list of tables (as when interactively imported)
out1out2 <- list( out1[, 1:4 ], out2[, 1:4 ] )
names(out1out2) <- c( "out1", "out2" )
macroPlot( x = out1out2, gui = FALSE, subPlots = TRUE )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.