plot_var_nc | R Documentation |
Plots variables directly from a .nc file output from a GLM simulation. Replaces function plot_var.
plot_var_nc(
nc_file = "output.nc",
var_name = "temp",
fig_path = NULL,
reference = "surface",
legend.title = NULL,
interval = 0.5,
text.size = 12,
show.legend = TRUE,
legend.position = "right",
plot.title = NULL,
color.palette = "RdYlBu",
color.direction = -1,
zlim = NULL,
...
)
plot_var(
nc_file = "output.nc",
var_name = "temp",
fig_path = NULL,
reference = "surface",
legend.title = NULL,
interval = 0.5,
text.size = 12,
show.legend = TRUE,
legend.position = "right",
plot.title = NULL,
color.palette = "RdYlBu",
color.direction = -1,
zlim = NULL,
...
)
nc_file |
a string with the path to the netcdf output from GLM |
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 |
reference |
String; 'surface' or 'bottom'. Only used for heatmap plots. We recommend using 'bottom' if surface levels are fluctuating. This will present a more realistic representation of surface conditions. |
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. |
text.size |
Integer; Default is 12. Higher values will increase text size in plot. |
show.legend |
Logical; TRUE to show legend (default), FALSE to hide legend |
legend.position |
String; Legend position. Default is 'right'. Options: 'left','right','top','bottom' |
plot.title |
Vector string; Default is no title. |
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). |
zlim |
Color palette limits for z-variable. Default is maximum range of variable. Set as c(value,value). |
... |
additional arguments passed to |
plot_var
: Deprecated. Use plot_var_nc
Jordan S. Read, Luke A. Winslow, Hilary A. Dugan
get_temp
, sim_var_longname
,
sim_vars
, plot_temp
, get_var
nc_file <- system.file("extdata", "output/output.nc", package = "glmtools")
plot_var_nc(nc_file, 'temp')
#Plotting two variables
plot_var_nc(nc_file, var_name = c('temp','wind'), show.legend = FALSE,
text.size = 14, plot.title = c('My Lake: Temp','My Lake: Wind'))
#Change color palette
plot_var_nc(nc_file, var_name = 'temp', color.palette = 'PuBuGn',
color.direction = 1, show.legend = FALSE)
## Not run:
#'#How to save a plot
plot_var_nc(nc_file,var_name = c('temp', 'u_mean'),
fig_path = './figtest.png', width = 6, height = 2, units = 'in')
# need to specify a valid .nc file here:
plot_var_nc(file = fabm_sim_nc.nc,
var_name = 'aed_oxygen_oxy',
fig_path = 'aed_out.png')
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.