-
Notifications
You must be signed in to change notification settings - Fork 633
Description
Just a huge fan of Plotly and basically all of the ggridges plots, showing my interest here.
here's an example function:
pdr_ann_perav_wysum_taf_d <- function(df) {
df_mn <- df %>% group_by(dv,scen) %>% summarize(annmean = 12*mean(taf))
df_md <- df %>% group_by(dv,scen,wy) %>% summarize(wysumtaf = sum(taf)) %>% group_by(scen, dv) %>% summarize(median = median(wysumtaf))
df %>% filter(kind != "storage") %>% group_by(scen, dv, wy) %>% summarize(wytafsum = sum(taf))
%>%
ggplot(aes(x=wytafsum, y=scen, color=dv, point_color=dv, fill=dv)) +
geom_density_ridges(jittered_points=TRUE, scale = .95, rel_min_height = .01,
point_shape = "|", point_size = 3, size = 0.25,
position = position_points_jitter(height = 0), alpha = 0.5) +
scale_y_discrete(expand = c(.01, 0)) +
scale_x_continuous(expand = c(0, 0), name = "water year total (taf) [difference]", sec.axis =
dup_axis(name = NULL)) +
theme_ridges(center = TRUE) + ggtitle("82 water year totals, difference from baseline") +
theme_gray() +
geom_point(data = df_md, mapping = aes(x = median, y = scen, color = dv), shape = 124, size = 10) +
geom_point(data = df_mn, mapping = aes(x = annmean, y = scen, fill = dv), color = "black", shape = 21)
}
Please briefly describe your problem and what output you expect. If you have a question, please don't use this form, but instead ask on the community forum http://community.plot.ly/c/api/r or stackoverflow http://stackoverflow.com.
Please include a minimal reprex. The goal of a reprex is to make it as easy as possible for me to recreate your problem so that I can fix it. If you've never heard of a reprex before, start by reading https://github.com/jennybc/reprex#what-is-a-reprex, and follow the advice further down the page. Do NOT include session info unless it's explicitly asked for, or you've used reprex::reprex(..., si = TRUE)
to hide it away.
Delete these instructions once you have read them.
Brief description of the problem
# insert reprex here