View source: R/plot_var_compare.R
plot_var_compare | R Documentation |
Plot matching heatmaps for modeled and observed temp
plot_var_compare(
nc_file,
field_file,
var_name = "temp",
fig_path = NULL,
resample = TRUE,
precision = "hours",
conversion = NULL,
legend.title = NULL,
interval = 1,
method = "match",
text.size = 12,
color.palette = "RdYlBu",
color.direction = -1,
obs.color = "white",
obs.alpha = 0.6,
obs.shape = 16,
obs.size = 1,
shiftPalette = NULL,
zlim = NULL,
...
)
nc_file |
Netcdf model output file |
field_file |
CSV or TSV field data file (see resample_to_field for format) |
var_name |
a character vector of valid variable names (see |
fig_path |
Default is NULL (only plots to screen). Enter string path to save as output file. File type can be anything supported by |
resample |
sample the model output to the same time points as the observations? |
precision |
the time interval of the output.nc file and the field file must match (options: 'secs', 'mins','hours', or 'days') |
conversion |
conversion multiplier to adjust model output to field data units |
legend.title |
Vector string; Default ('NULL') will use variable and units from netcdf file |
interval |
Positive number indicating the depth interval in meters to interpolate output data. Must be less than max depth of lake. Default = 0.5 m. |
method |
String; 'match' for exact match or 'interp' for temporal interpolation |
text.size |
Integer; Default is 12. Higher values will increase text size in plot. |
color.palette |
See: |
color.direction |
Sets the order of colors in the scale. If 1, colors are as output by brewer.pal. If -1, the order of colors is reversed (default). |
obs.color |
Color of observation points. For options see: vignette("ggplot2-specs") |
obs.alpha |
Alpha transparency of observation points. If set to 0, no points will appear. For options see: vignette("ggplot2-specs") |
obs.shape |
Shape of observation points. For options see: vignette("ggplot2-specs") |
obs.size |
Size of observation points. For options see: |
shiftPalette |
See values argument in: |
zlim |
Color palette limits for z-variable. Default is maximum range of variable. Set as c(value,value). |
... |
additional arguments passed to |
Jordan S. Read, Luke A. Winslow, Hilary A. Dugan
Internally uses get_var and resample_to_field
nc_file <- system.file("extdata", "output/output.nc", package = "glmtools")
field_file <- system.file("extdata", "LakeMendota_field_data_hours.csv", package = "glmtools")
plot_var_compare(nc_file, field_file, 'temp', resample = FALSE) ##makes a plot
## Not run:
#Change color palette, custom legend title, save figure:
plot_var_compare(nc_file, field_file, var_name = 'temp', resample = TRUE,
legend.title = 'Temp (*C)', color.palette = 'PuBuGn', color.direction = 1,
fig_path = './figtest.png', width = 6, height = 8, units = 'in')
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.