Skip to content

Instantly share code, notes, and snippets.

@WayneAHof
WayneAHof / Sample Plotting Example.R
Created August 14, 2024 22:17
Sample script to create ggplots incorporating RMSE, MBE and NSE (based on COD method) plus an example of how to create an animated plot and interactive plot
# Libraries ----
library(dplyr)
library(ggplot2) # Plotting data
library(ggrepel) # Prevent overlapping text labels
library(Metrics) # Calculate Statistics
library(plotly) # Interactive plots
library(gganimate) # Animate plots
# Sample Statistical Plots ----
# Create sample data
@WayneAHof
WayneAHof / NZ Map Example.R
Created August 29, 2024 04:42
How to make a simple NZ Map
# Draw a NZ map and plot two points of interest
# Load libraries
library(ggplot2)
library(sf)
library(maps)
# Load New Zealand map data
nz_map <- st_as_sf(map("nz", plot = FALSE, fill = TRUE))