Learn R Programming

heatwaveR (version 0.4.4)

plotly_helpers: Plotly helpers

Description

This S3 method for GeomFlame allows it to be implemented with plotly::ggplotly()

Usage

# S3 method for GeomFlame
geom2trace(data, params, p)

Arguments

data

This is a data.frame of information passed to this function from plotly:::layers2traces

params

This is a packet of specific information also passed to this functions from plotly:::layers2traces

p

This is the base plot created by calling ggplot, but is still passed to this functions from plotly:::layers2traces

Examples

Run this code
# NOT RUN {
ts_res <- ts2clm(data = sst_WA, climatologyPeriod = c("1982-01-01", "2011-12-31"))
ts_res_sub <- ts_res[10500:10800,]

library(ggplot2)
library(plotly)

p <- ggplot(data = ts_res_sub, aes(x = t, y = temp)) +
  geom_flame(aes(y2 = thresh), fill = "salmon") +
  geom_line(aes(y = temp)) +
  geom_line(aes(y = seas), colour = "green") +
  geom_line(aes(y = thresh), colour = "red") +
  labs(x = "", y = "Temperature (<U+00B0>C)")
 plotly::ggplotly(p)

# }

Run the code above in your browser using DataLab