marinebon / infographiqR

R functions for creation of interactive intelligent infographics, ie infographiq
https://marinebon.github.io/infographiqR
MIT License
11 stars 2 forks source link

new plot function for streamgraphs #36

Open 7yl4r opened 6 years ago

7yl4r commented 6 years ago

Breaking this issue out from #21

@reikopm is wants a plotter for eDNA data and provides R code for creating a stacked bar graph:

txt = "urlstr='https://raw.githubusercontent.com/reikopm/info-mb/master/prep/data/phytoplankton/efm_taxa_structure_means.csv'
dat <- read.csv(url(urlstr))
dat$Season <- factor(dat$Season, levels = c("Spring", "Summer", "Fall", "Winter"))

library(plotly)

t <- list(
family = 'helvetica',
size = 24,
color = 'black')

p1 <- plot_ly(dat, x = ~Season, y = ~asyn, type = 'bar', name = 'Synechococcus',width=2040, height=1080) %>%
add_trace(y = ~arfp, name = 'Red Fluorescing Picoplankton') %>%
add_trace(y = ~aprym, name = 'Haptophyte') %>%
add_trace(y = ~aaflag, name = 'Autotrophic Flagellate') %>%
add_trace(y = ~aadino, name = 'Autotrophic Dinoflagellate') %>%
add_trace(y = ~acryp, name = 'Cryptomonad') %>%
add_trace(y = ~aprasy, name = 'Prasinophyte') %>%
add_trace(y = ~aphaeo, name = 'Phaeocystsis') %>%
add_trace(y = ~apen, name = 'Pennate Diatom') %>%
add_trace(y = ~acen, name = 'Centric Diatom') %>%
add_trace(y = ~ahdino, name = 'Heterotrophic Dinoflagellate') %>%
add_trace(y = ~ahflag, name = 'Heterotrophic Flagellate') %>%
add_trace(y = ~achoano, name = 'Choanoflagellate') %>%
add_trace(y = ~ahcryp, name = 'Leucocryptos') %>%
add_trace(y = ~ahcil, name = 'Heterotrophic Ciliate') %>%
add_trace(y = ~aacil, name = 'Autotrophic Ciliate') %>%
layout(font=t,yaxis = list(title = 'mg C m-3'),barmode = 'stack') %>%
layout(font=t,title = 'Q10:Taxonomic Structure', margin = 1)
print(p1)"

image

This is also a good use-case for a streamgraph, so perhaps we should include a new plot-function option (ie a new .rmd.brew file in ./inst/plotting_functions/)