Plot climate change vectors
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | plot_vocc(
df,
fill_col = NULL,
fill_label = NULL,
raster_alpha = 1,
vec_aes = "distance",
grad_vec_aes = NULL,
arrowhead_size = 0.005,
vec_lwd_range = c(0.7, 0.8),
vec_alpha = 1,
max_vec_plotted = max(df$distance),
min_vec_plotted = 4,
NA_label = "NA",
white_zero = min(fill, na.rm = TRUE) < 0,
low_fill = "#3d95cc",
mid_fill = "white",
high_fill = "Red 3",
na_colour = "red",
vec_col = "grey37",
coast = TRUE,
contours = TRUE,
axis_lables = FALSE,
viridis_option = "D",
viridis_dir = 1,
viridis_begin = 0.2,
viridis_end = 1,
transform_col = no_trans,
raster_limits = NULL,
raster_cell_size = 2,
legend_position = c(0.15, 0.25),
tag_text = NULL,
make_square = TRUE,
grey_water = TRUE,
theme_black = FALSE
)
|
df |
Dataframe produced by dist_based_vocc function. |
fill_col |
Vector name for colouring raster grid cells. |
fill_label |
Label for legend for raster grid cell colour. |
raster_alpha |
Raster transparency. |
vec_aes |
Vector name for any plotting distance-based vectors. |
grad_vec_aes |
Vector name for plotting gradient-based vectors. Default NULL for distance-based vectors. |
arrowhead_size |
Changes head size for custom geom_quiver function. |
vec_lwd_range |
Range in vector line widths. |
vec_alpha |
Vector transparency. |
max_vec_plotted |
Upper limit for vector lengths. Cells with no match less than this distance will be labeled with [NA_label]. |
min_vec_plotted |
Lower limit for vector lengths actually plotted. |
NA_label |
Symbol used to indicate cells with no analog. Default is "NA". |
white_zero |
If TRUE, will always plot on custom fill scale. Default will plot on this scale only if raster has negative values. |
low_fill |
Colour of negative values if raster values span zero. |
mid_fill |
Colour of zero value raster cells. |
high_fill |
Colour of positive values if raster values span zero. |
na_colour |
Raster colour for values exceeding raster_limits. |
vec_col |
Colour of vectors. |
coast |
Coast polygons where (x = "X", y = "Y", group = "PID"). If TRUE, will attempt to create them for xy values in df. Will not include if FALSE. |
contours |
Polygons of contour lines where (x = "X", y = "Y", group = "paste(PID, SID)"). If TRUE, will attempt to create bathymetry layer for xy values in df using gfplot. |
axis_lables |
Logical for inclusion of axis labels. |
viridis_option |
Change between viridis colormap options available in ggplot. |
viridis_dir |
Option to flip scale by giving value of -1. |
viridis_begin |
Value to start viridis scale at |
viridis_end |
Value to end viridis scale at |
transform_col |
Apply transformation to colour scale. Accepts standard options (e.g. "sqrt") or unquoted custom transformations defined using scales::trans_new (e.g. fourth_root_power). Default is to apply no transformation (no_trans). |
raster_limits |
Range of values to plot; those in excess will be red. Default of "NULL" plots full range. |
raster_cell_size |
Raster cell width. Used to centre NA_label. |
legend_position |
Vector of coordinates for legend placement. Or "none" to remove legend. |
tag_text |
Text to be added to top right corner of plot |
make_square |
Logical for adding space to map to make it square |
grey_water |
Make water (panel background) light grey |
theme_black |
Logical for inverting plot to white on black |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.