Skip to contents

Plot wavelet to look similar to base R plot of WaveletComp::wt.image using ggplot2 functionality. Some visual choices were made to reflect work done by Steven Lee (https://github.com/davidearn/StevenLee) and Kevin Zhao (https://github.com/davidearn/KevinZhao).

Usage

iidda_plot_wavelet(
  plot_object,
  data = NULL,
  wavelet_data,
  contour_data,
  y_variable_name = "Period (years)",
  fill_variable_name = "Power",
  max_period = 10,
  colour_levels = 250,
  start_hue = 0,
  end_hue = 0.7,
  sig_lvl = 0.05
)

Arguments

plot_object

a `ggplot2` plot object

data

data frame containing wavelet data prepped for use in ggplot2::geom_tile. The output from iidda_prep_wavelet produces a data set prepped for this argument, named tile_data_to_plot in the returned list. If `NULL` data is inherited from `plot_object`.

wavelet_data

list containing raw wavelet transformed data, typically output from WaveletComp::analyze.wavelet. The output from iidda_prep_wavelet produces a data set prepped for this argument, named transformed_data in the returned list.

contour_data

data set containing contour data prepped for use in ggplot2::geom_contour. The output from iidda_prep_wavelet produces a data set prepped for this argument, named cont_data_to_plot in the returned list.

y_variable_name

name of y variable in plot, defaults to "Period (years)".

fill_variable_name

name of colour fill variable in plot, defaults to "Power".

max_period

maximum period to appear on the plot, defaults to 10 years.

colour_levels

number of colours to pass to scale_fill_gradientn.

start_hue

starting hue colour to pass to scale_fill_gradientn, default taken from WaveletComp::wt.image.

end_hue

ending hue colour to pass to scale_fill_gradientn, default taken from WaveletComp::wt.image.

sig_lvl

significance level for white contours

Value

a ggplot2 object of a wavelet