Hi,
I have a question regarding the unemployment chart example in http://moderndata.plot.ly/interactive-r-visualizations-with-d3-ggplot2-rstudio/.
Specifically this portion of code used:
p %>%
add_trace(y = fitted(loess(uempmed ~ as.numeric(date)))) %>%
layout(title = “Median duration of unemployment (in weeks)”,
showlegend = FALSE) %>%
dplyr::filter(uempmed == max(uempmed)) %>%
layout(annotations = list(x = date, y = uempmed, text = “Peak”, showarrow = T))
When I plot it, I cannot get the loess to coincide with the plotly chart. Upon displaying only trace 1, it seems the scale of the date axis is different. Any idea how to rectify this? Thanks for your help!
Regards,
Edmund