plot_var_df | R Documentation |
Plot variables from a data frame
plot_var_df(
data,
var_name,
interpolate = F,
fig_path = NULL,
legend.title = var_name,
text.size = 12,
show.legend = TRUE,
legend.position = "right",
plot.title = NULL,
color.palette = "RdYlBu",
color.direction = -1,
reference = "surface",
zlim = NULL,
...
)
data |
a dataframe directly from GLM output or field data. First column must be date/dateTime (Date or POSIXct format). Second column is depth. Subsequent columns are variable data. Format can be wide or long. If long format, can support multiple variables. |
var_name |
a character vector of the variable names |
interpolate |
Logical; FALSE = do not inteprolate data. TRUE = Interpolate data to daily timestep and 1 m depth interval |
fig_path |
Default is NULL (only plots to screen). Enter string path to save as output file. File type can be anything supported by |
legend.title |
Vector string; Default ('NULL') will use variable and units from netcdf file |
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). |
reference |
String; 'surface' or 'bottom'. surface = Depths are referenced from the surface, bottom = Depths are referenced from the bottom (elevations) |
zlim |
Color palette limits for z-variable. Default is maximum range of variable. Set as c(value,value). |
... |
additional arguments passed to |
plot_var
uses the layout
function and so is restricted to a full page display.
When creating a heatmap, the output produced by plot_var
is actually a combination of two plots;
one is a .filled.contour
plot and the other is a legend.
Jordan S. Read, Luke A. Winslow, Hilary A. Dugan
get_var
, sim_var_longname
,
sim_vars
, plot_var
nc_file <- system.file("extdata", "output/output.nc", package = "glmtools")
data = get_var(nc_file,'temp', reference = 'surface')
plot_var_df(data, var_name = 'temp', interpolate = FALSE, legend.title = 'Temp (degC)')
## Not run:
#Saving plot
plot_var_df(data, var_name = 'temp',fig_path = '~/figtest.png', width = 6, height = 2, units = 'in')
# need to specify a valid .nc file here:
plot_var(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.