Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

R ggplot minimal working examples for dashR? #118

Closed
heoa opened this issue Aug 15, 2019 · 2 comments
Closed

R ggplot minimal working examples for dashR? #118

heoa opened this issue Aug 15, 2019 · 2 comments

Comments

@heoa
Copy link

heoa commented Aug 15, 2019

I want a collection of interactive minimal working examples of using ggplot with dashR. Thank you.

@heoa
Copy link
Author

heoa commented Aug 15, 2019

I start collecting here some demos about using ggplot with dashR.

Categorial selector

#71 (comment)

Timeseries starting time selector with slider

library(data.table)
library(dash)
library(plotly)
library(dashHtmlComponents)
library(dashCoreComponents)
library(ggthemes)

app <- Dash$new(external_stylesheets = "https://codepen.io/chriddyp/pen/bWLwgP.css")

app$layout(
  htmlDiv(list(
    htmlDiv(list(
      htmlH3("Plotly.js importing test using BOD data")
    ),
    className = 'row'),
    htmlDiv(list(
      dccSlider(id   = 'starting-time-slider',min  = 1,max  = 7,step = 1,value= 1)),
      className = 'row'),
    htmlDiv(list(
      htmlH4('Time selector', className = 'six columns')
    ),
    className = 'row'),
    htmlDiv(list(
      htmlDiv(
        id = 'div-ts',
        className = 'six columns')), 
      className='row')
  )
  )
)

app$callback(output=list(id='div-ts', property='children'),
             params=list(
               input(id='starting-time-slider', property='value')),
             function(StartTime)
             {
               subdata <- BOD[BOD$Time>StartTime,]                 
               ggts <- ggplot(subdata) + 
                 aes(x=Time, y=demand) + geom_point() + geom_smooth() + theme_economist()
               dccGraph(id = 'graph-ts', figure = ggplotly(ggts))
             }
)

app$run_server()

#71 (comment)

@heoa heoa changed the title R ggplot minimal working examples for dashR, interactive? R ggplot minimal working examples for dashR? Aug 15, 2019
@rpkyle
Copy link
Contributor

rpkyle commented Sep 3, 2019

Assuming that the original example was helpful for answering your initial question, I'm planning to close this issue in 48 hours unless there are any remaining items to resolve. Thanks!

@rpkyle rpkyle closed this as completed Sep 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants