Coder Social home page Coder Social logo

rbokeh's Introduction

Bokeh logo -- text is white in dark theme and black in light theme

Bokeh is an interactive visualization library for modern web browsers. It provides elegant, concise construction of versatile graphics and affords high-performance interactivity across large or streaming datasets. Bokeh can help anyone who wants to create interactive plots, dashboards, and data applications quickly and easily.

Package Latest package version Supported Python versions Bokeh license (BSD 3-clause)
Project Github contributors Link to NumFOCUS Link to documentation
Downloads PyPI downloads per month Conda downloads per month NPM downloads per month
Build Current Bokeh-CI github actions build status Current BokehJS-CI github actions build status Codecov coverage percentage
Community Community support on discourse.bokeh.org Bokeh-tagged questions on Stack Overflow

Consider making a donation if you enjoy using Bokeh and want to support its development.

4x9 image grid of Bokeh plots

Installation

To install Bokeh and its required dependencies using pip, enter the following command at a Bash or Windows command prompt:

pip install bokeh

To install conda, enter the following command at a Bash or Windows command prompt:

conda install bokeh

Refer to the installation documentation for more details.

Resources

Once Bokeh is installed, check out the first steps guides.

Visit the full documentation site to view the User's Guide or launch the Bokeh tutorial to learn about Bokeh in live Jupyter Notebooks.

Community support is available on the Project Discourse.

If you would like to contribute to Bokeh, please review the Contributor Guide and request an invitation to the Bokeh Dev Slack workspace.

Note: Everyone who engages in the Bokeh project's discussion forums, codebases, and issue trackers is expected to follow the Code of Conduct.

Support

Fiscal Support

The Bokeh project is grateful for individual contributions, as well as for monetary support from the organizations and companies listed below:

NumFocus Logo CZI Logo Blackstone Logo
TideLift Logo Anaconda Logo NVidia Logo Rapids Logo

If your company uses Bokeh and is able to sponsor the project, please contact [email protected]

Bokeh is a Sponsored Project of NumFOCUS, a 501(c)(3) nonprofit charity in the United States. NumFOCUS provides Bokeh with fiscal, legal, and administrative support to help ensure the health and sustainability of the project. Visit numfocus.org for more information.

Donations to Bokeh are managed by NumFOCUS. For donors in the United States, your gift is tax-deductible to the extent provided by law. As with any donation, you should consult with your tax adviser about your particular tax situation.

In-kind Support

Non-monetary support can help with development, collaboration, infrastructure, security, and vulnerability management. The Bokeh project is grateful to the following companies for their donation of services:

rbokeh's People

Contributors

bryevdv avatar hafen avatar jrowen avatar schloerke avatar timelyportfolio avatar tr8dr avatar yihui avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rbokeh's Issues

ly_text gives `[Object object]` when used for labelling

I thought this little example would be great to demo rbokeh, but I get an error with ly_text. I can chase it down but wanted to make sure it wasn't something simple.

#http://stats.stackexchange.com/questions/31726/scatterplot-with-contour-heat-overlay
library(MASS)  # in case it is not already loaded 
set.seed(101)
n <- 1000
X <- mvrnorm(n, mu=c(.5,2.5), Sigma=matrix(c(1,.6,.6,1), ncol=2))
## some pretty colors
library(RColorBrewer)
k <- 11
my.cols <- rev(brewer.pal(k, "RdYlBu"))
## compute 2D kernel density, see MASS book, pp. 130-131
z <- kde2d(X[,1], X[,2], n=50)
plot(X, xlab="X label", ylab="Y label", pch=19, cex=.4)
contour(z, drawlabels=FALSE, nlevels=k, col=my.cols, add=TRUE)
abline(h=mean(X[,2]), v=mean(X[,1]), lwd=2)
legend("topleft", paste("R=", round(cor(X)[1,2],2)), bty="n")


library(rbokeh)
figure( width = 700, height = 400 ) %>%
  ly_points( X[,1], X[,2], size = 2 ) %>%
  ly_contour( z=z$z, x=z$x, y=z$y, nlevels = k, col = my.cols ) %>%
  ly_text( 
    x = min(pretty(X[,1]))
    ,y =  max(pretty(X[,2]))
    ,text = paste("R=", round(cor(X)[1,2],2))
  )

image

Allow hover for line plots

right now the ly_lines layer doesn't support the hover function. So a line plot cannot be traced. Since the line plot is made of points, allow the hover to atleast work if the mouse is over those points

Pandoc error when trying to include rbokeh plot in rmarkdown document

I have a small block in an Rmarkdown document in which I am trying to include an rbokeh plot.

'''{r}
library(rbokeh)
p <- figure() %>%
  ly_points(Sepal.Length, Sepal.Width, data = iris,
    color = Species, glyph = Species,
    hover = list(Sepal.Length, Sepal.Width))
p
'''

I get this error when I try knitting the document. On the file system, this file does not exist. In fact, even the images folder does not exist.

pandoc: Could not find data file /Library/Frameworks/R.framework/Versions/3.2/Resources/library/rbokeh/htmlwidgets/lib/bokehjs/images/ui-bg_flat_75_ffffff_40x100.png
Error: pandoc document conversion failed with error 97
Execution halted

And sessionInfo():

> sessionInfo()
R Under development (unstable) (2014-10-24 r66864)
Platform: x86_64-apple-darwin13.4.0 (64-bit)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] rbokeh_0.2           BiocInstaller_1.17.5

loaded via a namespace (and not attached):
 [1] devtools_1.6.1    digest_0.6.4      evaluate_0.5.5    formatR_1.0
 [5] grid_3.2.0        hexbin_1.27.0     htmltools_0.2.6   htmlwidgets_0.3.2
 [9] httr_0.5          knitr_1.8         lattice_0.20-29   magrittr_1.5
[13] maps_2.3-9        RCurl_1.95-4.3    RJSONIO_1.3-0     stringr_0.6.2
[17] tcltk_3.2.0       tools_3.2.0

Any suggestions?

R - rbokeh and htmlwidgets Compatibility

Receiving the following error when attempting to use the current version of rbokeh.h

Error in htmlwidgets::createWidget(name = "rbokeh", x = list(spec = spec, :
unused argument (preRenderHook = rbokeh_prerender)

Hover on categorical data

I am trying to get hovering on a plot with categorical data on the y-axis. It does not seem to work. Here is the code [p1 does not give hovering info, p2 does]:

data(mtcars)
mtcars$models = factor(row.names(mtcars))

p1 = figure() %>%
ly_points(mpg, models, data = mtcars,
hover = list(mpg, models))

p2 = figure() %>%
ly_points(disp, mpg, data = mtcars,
hover = c(disp, mpg))

grid_plot(list(p1,p2),link_data = T)

text layer shows [object Object] for single row data.frame

This layer is not showing text as expected when a single row data.frame is used

DF = data.frame(x = 1, y = 1, text = "here")
figure() %>%
  ly_text(x = x, y = y, text = text, data = DF)

but adding another row works as expected

DF = data.frame(x = 1, y = 1, text = "here")
DF = rbind(DF, data.frame(x = 2, y = 2, text = "there"))
figure() %>%
  ly_text(x = x, y = y, text = text, data = DF)

This was an attempt to annotate a single point on a chart.

grid_plot not displaying properly with shiny

In the example below, the individual grid plots become "compressed" (y-axis collapses onto itself at at the x-axis; point not visible) after the second change of select the dropdown.

library(shiny)
library(rbokeh)

df = rbind(
  data.frame(bucket = "First", group = rep(c("a", "b"), 5), x = rnorm(10), y = rnorm(10)),
  data.frame(bucket = "Second", group = rep(c("a", "b"), 5), x = rnorm(10), y = rnorm(10))
)

ui = shinyUI(fixedPage(
  fixedRow(
    selectInput("bucket", "Bucket", c("First", "Second"))
  ),
  fixedRow(
    rbokehOutput("rbka")
  )
))

server = function(input, output) {
  output$rbka <- renderRbokeh({
    tmp = df[df$bucket == input$bucket, ]
    grid_plot(lapply(unique(df$group), function(x) {
      figure(xlab = "x", ylab = "y") %>%
        ly_points(x, y, data = tmp[tmp$group == x, ])
    }))
  })
}

shinyApp(ui = ui, server = server)

I'm using v0.2.3.1 and don't see any error messages in the JS console. Specifying ylim and xlim doesn't help.

`grid_plot` changes manual `xlim` with `same_axes=T`

I noticed that grid_plot removes the forced xlim provided as a parameter to figure().

data(Chem97, package = "mlmRev")
library(dplyr)
library(rbokeh)

lapply(
    levels(Chem97$gender)
    ,function(g){
        # non facet first since first boxplot
        figure( width = 500, height = 300
                # little clunky to force sort on categorical axis
                , xlim = as.character(sort(unique(Chem97$score)))
        ) %>>%
            ly_boxplot(
                as.character(score)
                ,gcsescore
                ,data = filter(Chem97, gender == g)
            ) %>>%
            x_axis(label = "Average GCSE Score")   
    }
) %>>%
    (~  show(grid_plot( ., nrow = 1, ncol = 2 )) ) %>>%
    grid_plot( nrow = 1, ncol = 2, same_axes=T )

image

Creating standalone plots

I would like to create standalone html pages. Generating html like this works:

output:
  html_document:
    self_contained: no

---

```{r}
library(rbokeh)
 figure() %>% ly_points(cars$speed, cars$dist)

but as soon as I select "Create a standalone HTML document" I get a pandoc 67 error:

pandoc: Could not fetch /home/henk/R/x86_64-pc-linux-gnu-library/3.2/rbokeh/htmlwidgets/lib/bokehjs/images/ui-bg_flat_75_ffffff_40x100.png
/home/henk/R/x86_64-pc-linux-gnu-library/3.2/rbokeh/htmlwidgets/lib/bokehjs/images/ui-bg_flat_75_ffffff_40x100.png: openBinaryFile: does not exist (No such file or directory)
Error: pandoc document conversion failed with error 67
Execution halted

So the question is: how can I generate a standalone HTML file?

rbokehOutput, size of output

via ??rbokehOutput, I get rbokeh::rbokehOutput with an example, see code below.

The example does not work, see comments and modification.

The question is: how do I increase height and width of the figure? The current size is too small [have to scroll]. The help says rbokehOutput(outputId, width = '100%', height = '400px'), but this does not affect the output in my case.

output:
  html_document:
    self_contained: no
runtime: shiny

---
{r}
library("shiny")
library("rbokeh")
library("htmlwidgets")

ui <- fluidPage(
  rbokehOutput("rbokeh", width = 500, height = 800)
)

server <- function(input, output, session) {
  output$rbokeh <- renderRbokeh({
    # Use invalidateLater() and jitter() to add some motion
    # invalidateLater(1000, session)  # continuous stream of xlim not specified explicitly... calculating...;  ylim not specified explicitly... calculating...
    p <- figure() %>%
      ly_points(jitter(cars$speed), jitter(cars$dist))
    # rbokeh:::plot.BokehFigure(p)  # does not work
    p  # works
  })
}

shinyApp(ui, server)

Infer shape parameter for hexbin from specified width and height?

The shape parameter in ly_hexbin is used to make sure hexagons have the right aspect ratio in the plot. This could be automatically inferred from the specified width and height if not specified.

Another good default for ly_hexbin would be to not allow resize (or it would be nice to have a resize tool option that preserves aspect ratio - like holding shift while resizing in photoshop).

Also, if the user specifies log=TRUE for an axis, that messes things up too.

Or perhaps it's best to just leave all of this to the user.

Make `ly_boxplot()` more robust

ly_boxplot() was put together pretty quickly. It needs to be made more robust to allow putting the categorical variable on either axis, coloring of the boxes, etc.

hover does not accept a data.frame when using shiny

I think this is similar to #72. The following app will not add hover to the chart points.

library(shiny)
library(rbokeh)

ui = shinyUI(fluidPage(
  sidebarLayout(
    sidebarPanel(
      selectInput("x", "X", LETTERS[1:3], "A"),
      selectInput("y", "Y", LETTERS[1:3], "B")
    ),
    mainPanel(
      rbokehOutput("plot")
    )
  )
))

server = function(input, output) {
  output$plot <- renderRbokeh({
    df_plot = data.frame(A = 1:10, B = 11:20, C = 21:30)

    figure() %>%
      ly_points(x = df_plot[[input$x]],
                y = df_plot[[input$y]],
                hover = df_plot)
  })
}

shinyApp(ui = ui, server = server)

The console states

hover tool not added - 'hover' must be a data frame or list of variables present in the data frame supplied as the 'data' argument
xlim not specified explicitly... calculating...
ylim not specified explicitly... calculating...

Everything works as expected when run outside of shiny.

df_plot = data.frame(A = 1:10, B = 11:20, C = 21:30)

figure() %>%
  ly_points(x = df_plot[["A"]],
            y = df_plot[["B"]],
            hover = df_plot)

Unable to pass data.frame as hover parameter when using lapply

Hover does not work with the example below. I think the problem is related to the substitute call being used to pass the hover parameter to rbokeh:::get_hover. In the example below, the tmp data.frame is not being found by substitute.

library(rbokeh)
DF = data.frame(x=1:10, y=1:10, z=11:20)
grid_plot(lapply(1:4, function(i) {
  tmp = DF
  figure() %>%
    ly_points(x = x, y = y, data = tmp, hover = tmp[, c("x", "z")])
}))

The change below looks like it may fix the issue. I'll admit I'm not very familiar with substitute and eval, so there may be a better solution.

if (is.data.frame(hover))
    hover <- get_hover(hover, data)
else
    hover <- get_hover(substitute(hover), data)

Question about ly_rect

Hello,

The following code:

library(rbokeh)
my_data = data.frame(xleft = 1, xright = 5, ybottom=1, ytop=3)
figure() %>% ly_rect(xleft=xleft, ybottom=ybottom, xright=xright, ytop=ytop, data = my_data)

Gives an error:

Error in v_eval(substitute(yright), data) : 
  argument 'yright' is not present in the 'data' argument

Is the code wrong?
Shouldn't yright be replaced by xright in line 121 of layer_shapes.R?

Thank you for this awesome package!

## R version 3.1.2 (2014-10-31)
## Platform: x86_64-w64-mingw32/x64 (64-bit)
## rbokeh_0.2.2

Should xlim reverse x axis scale?

Great project! Thanks for developing.

I was expecting xlim=c(10,0) to reverse the x axis scale but the order seems to be ignored, though it will adjust the limits appropriately.

Investigate ServerDataSource

One of Bokeh's coolest features is streaming data with ServerDataSource. We need to explore this and see how we could make it available in rbokeh.

line type not getting passed through with `ly_density`

I could easily be doing something wrong, but taking the simple density example from ?density, the type parameter does not seem to be passed through to ly_lines.

library(rbokeh)
library(pipeR)

x <- data.frame(x=c(-20, rep(0,98), 20))

list(
  density(x$x) %>>%
     (ly_lines(figure( height = 400, width = 700),x,y,data=data.frame(x=.$x,y=.$y),type=2)) 
  , ly_density( figure( height = 400, width = 700), x, x, type = 2)
) %>>%
  grid_plot( nrow = 2, ncol = 1 )

image

Multiple hover tool

Using the bokeh-0.9 branch I see multiple hover tool checkboxes on windows 8.1 Rstudio version 0.99.441
rplot

Error when running examples from [rbokeh](http://hafen.github.io/rbokeh/)

Hi,
Received an error when trying to follow the examples from rbokeh tutorial. With the following example,

 p <- figure() %>% 
  ly_points(Sepal.Length, Sepal.Width, data = iris, color = Species, 
            glyph = Species, hover = list(Sepal.Length, Sepal.Width))
 p

Insead of getting a bokeh plot, I received an error message :

Error in htmlwidgets::createWidget(name = "rbokeh", x = list(spec = spec,  : 
  unused argument (preRenderHook = rbokeh_prerender)

session_info():

R version 3.1.2 (2014-10-31)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] parallel  stats4    stats     graphics  grDevices utils     datasets  methods   base 
other attached packages:
 [1] htmlwidgets_0.3.3    housingData_0.1      dplyr_0.4.1          rbokeh_0.2.2         devtools_1.7.0      
 [6] pkgDepTools_1.32.0   RBGL_1.42.0          graph_1.44.1         BiocInstaller_1.16.4 ggplot2_1.0.1       
[11] pryr_0.1             RCurl_1.95-4.6       bitops_1.0-6         seqinr_3.1-3         ade4_1.7-2          
[16] Rcpi_1.2.0           AnnotationDbi_1.28.2 GenomeInfoDb_1.2.5   IRanges_2.0.1        S4Vectors_0.4.0     
[21] Biobase_2.26.0       BiocGenerics_0.12.1  RSQLite_1.0.0

Thank you.

get gylph error with ly_crect

cross-posted on mailing-list since not sure where to post.

I thought a correlation plot based on the periodic table would be a good example, but I run into this error.

Error in if (!glyph_name %in% names(glyph_props)) glyph_name <- "mappedGlyph" : 
  argument is of length zero

and separately get no hover on the points (but the periodic table works).

The code to reproduce is here. The ly_points works fine, but not ly_crect.

# correlation plot with ly_text using cor example
(Cl <- cor(longley))
# convert to long format with tidyr::gather
Cl_long <- tidyr::gather( data.frame(x = rownames(Cl),Cl), y, correlation, -x  )
# build our plot
(p <- figure(
  title = "Correlation Plot"
  ,ylim = unique(Cl_long$indicator)
  ,xlim = unique(Cl_long$indicator)
  ,xgrid = FALSE
  ,ygrid = FALSE
  ,height = 700
  ,width = 700
  ,tools = c("hover")
) %>%
  # get a plot but hover not working for me
  ly_points( x, y, data = Cl_long, color = correlation, size = correlation, hover = c(x,y) )
)
# but this doesn't work
p %>% ly_crect( x, y, data = Cl_long, color = correlation )

and I might just be using ly_crect incorrectly, since I did see that this sort of works.

(p <- figure(
  title = "Correlation Plot"
  ,ylim = unique(Cl_long$indicator)
  ,xlim = unique(Cl_long$indicator)
  ,xgrid = FALSE
  ,ygrid = FALSE
  ,height = 700
  ,width = 700
  ,tools = c("hover")
) %>%
  ly_points( x, y, data = Cl_long, glyph=15, size = correlation, color = correlation )
)

Tagging releases

Can you push tags for all your releases to GitHub. It will make it much easier to build conda packages.

Crash / conflict with other packages?

In a new R session I can repeatedly run this:

library(rbokeh)
figure() %>% ly_points(cars$speed, cars$dist)

However when I run this in an environment where I have my packages loaded, rbokeh crashes either immediately or after 1-2 times. "Crash" = hang so badly that I have to xkill R.

What would be the best method to find the problem?

Here is my session info. Also included is the rbokeh startup message for ggplot2.

Thanks!

> sessionInfo()
R version 3.2.0 (2015-04-16)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.2 LTS

locale:
 [1] LC_CTYPE=en_US.UTF-8          LC_NUMERIC=C                  LC_TIME=en_US.UTF-8           LC_COLLATE=en_US.UTF-8        LC_MONETARY=en_US.UTF-8       LC_MESSAGES=en_US.UTF-8      
 [7] LC_PAPER=en_US.UTF-8          LC_NAME=en_US.UTF-8           LC_ADDRESS=en_US.UTF-8        LC_TELEPHONE=en_US.UTF-8      LC_MEASUREMENT=en_US.UTF-8    LC_IDENTIFICATION=en_US.UTF-8

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] XLConnect_0.2-11    XLConnectJars_0.2-9 credit360_0.1       vcd_1.3-2           qcc_2.6             gridExtra_0.9.1     RCurl_1.95-4.5      bitops_1.0-6        jsonlite_0.9.16     DescTools_0.99.10  
[11] manipulate_0.98.932 Hmisc_3.15-0        Formula_1.2-0       survival_2.38-1     mi_0.09-19          arm_1.7-07          lme4_1.1-7          Rcpp_0.11.5         Matrix_1.2-0        MASS_7.3-39        
[21] psych_1.5.1         corrgram_1.7        DMwR_0.4.1          lattice_0.20-31     plyr_1.8.1          knitr_1.9           scales_0.2.4        gdata_2.13.3        stringr_0.6.2       treemap_2.2        
[31] ggplot2_1.0.1       reshape2_1.4.1      lubridate_1.3.3     zoo_1.7-12          data.table_1.9.5   

loaded via a namespace (and not attached):
 [1] splines_3.2.0       foreach_1.4.2       gtools_3.4.1        shiny_0.11.1.9004   TTR_0.22-0          latticeExtra_0.6-26 R2WinBUGS_2.1-19    quantreg_5.11       chron_2.3-45        digest_0.6.8       
[11] RColorBrewer_1.1-2  minqa_1.2.4         colorspace_1.2-6    htmltools_0.2.6     httpuv_1.3.2        SparseM_1.6         xtable_1.7-4        mvtnorm_1.0-2       mgcv_1.8-5          car_2.0-25         
[21] ROCR_1.0-5          nnet_7.3-9          pbkrtest_0.4-2      quantmod_0.4-4      mnormt_1.5-1        proto_0.3-10        mime_0.3            memoise_0.2.1       evaluate_0.5.5      nlme_3.1-120       
[31] gplots_2.16.0       xts_0.9-7           foreign_0.8-63      class_7.3-12        tools_3.2.0         formatR_1.0         gridBase_0.4-7      munsell_0.4.2       cluster_2.0.1       caTools_1.17.1     
[41] nloptr_1.0.4        rstudioapi_0.2      iterators_1.0.7     igraph_0.7.1        labeling_0.3        tcltk_3.2.0         boot_1.3-15         gtable_0.1.2        codetools_0.2-11    abind_1.4-3        
[51] TSP_1.1-0           R6_2.0.1            seriation_1.0-14    KernSmooth_2.23-14  rJava_0.9-6         parallel_3.2.0      rpart_4.1-9         acepack_1.3-3.3     gclus_1.3.1         coda_0.17-1        

> library(rbokeh)

Attaching package: ‘rbokeh’

The following object is masked from ‘package:ggplot2’:

    scale_size

Error in htmlwidgets::createWidget unused argument

Hello I just discovered Rbokeh. It looks very nice indeed.

To make some tests, I freshly installed rBokeh and htmlwidgets for my R 3.2.0 under Linux. When I try the example in the homepage, I get the following error :

figure() %>% ly_points(1:10) %>%
tool_lasso_select()
Error in htmlwidgets::createWidget(name = "rbokeh", x = list(spec = spec,  : 
unused argument (preRenderHook = rbokeh_prerender)

Is there anything I'm doing wrong? Can you please help?
thanks

named lists do not work with grid_plot

Not necessarily a bug, but probably should be documented that named lists don't work in grid_plot. I guess could easily unname any list passed as x in grid_plot.

Give a message/warning when adding a layer with a very large number of points?

People may not realize that these aren't raster graphics and that every single point is being sent to the browser, which can have an effect on performance. It might be good to have a threshold above which a warning or message is given, maybe suggesting alternatives (use quantiles, hexbins, image plots, etc.).

cleaner shiny integration

@timelyportfolio, could you look into making embedding into shiny more straightforward? When running the scaffolding with htmlwidgets, I get the following boilerplate:

#' Widget output function for use in Shiny
#'
#' @export
rbokehOutput <- function(outputId, width = '100%', height = '400px'){
  shinyWidgetOutput(outputId, 'rbokeh', width, height, package = 'rbokeh')
}

#' Widget render function for use in Shiny
#'
#' @export
renderRbokeh <- function(expr, env = parent.frame(), quoted = FALSE) {
  if (!quoted) { expr <- substitute(expr) } # force quoted
  shinyRenderWidget(expr, rbokehOutput, env, quoted = TRUE)
}

It would be nice to have this part of the package so that there are dedicated functions for embedding. Could you look into this?

ly_lines() gives error when using color parameter

Following the online documentation, I think that the color argument of ly_lines() should work in the same way as for ly_points(). However, I get a funky error message in the former case.

# default example works.
figure() %>% ly_points(Sepal.Length, Sepal.Width, data = iris, color = Species)

# substitute ly_lines for ly_points and it throws error.
figure() %>% ly_lines(Sepal.Length, Sepal.Width, data = iris, color = Species)
Error in nchar(opts[[fld]]) : 'nchar()' requires a character vector

# it appears to have to do something with Species being a factor, because if that class is removed
# then the plot appears (but ignores coloration of the levels of Species).
iris$Species <- as.character(levels(iris$Species))[iris$Species]
figure() %>% ly_lines(Sepal.Length, Sepal.Width, data = iris, color = Species)

Superficially (to my inexperienced eyes), the code handling the color parameter is highly similar between ly_points() and ly_lines() but apparently, something elsewhere messes up.

Hover doesn't work for single points

It just shows the first character. For example:

figure() %>% ly_points(Sepal.Length, Sepal.Width, hover = Species, data = iris[1,])

This is a json encoding issue - things are encoded as a scalar rather than singleton array - should be easy to fix.

buttons on the top not working under rstudio

I just installed the latest github versions of both htmlwidgets and rbokeh under the latest rstudio running the latest R (3.2.0) under ubuntu 14.

When I run the following command, under rstudio, clickin on the buttons "lasso select" and "box select" don't do anything. It keeps on panning. Actually none of the buttons do seem to work under rstudio. Am I doing something wrong?

figure() %>%

  • ly_points(Sepal.Length, Sepal.Width, data = iris, color = Species) %>%
  • tool_box_select() %>%
  • tool_lasso_select()

Also, when it works, is there a way to get the row/column indexes of the points that were chosen with these selection (box or lasso) tools?

thanks a bunch for this impressive work.

custom scales on axes

With ggplot2 I can do scale_y_continuous(trans=log2_trans()) to transform the scale of the y-axis to base 2 logs. How can I do this with rbokeh? All I can see is y_axis(log = TRUE)
thanks!

grid_plot `byrow` does not seem to affect result

Using your splom example,

tools <- c("pan", "wheel_zoom", "box_zoom", "box_select", "resize", "reset")
nms <- expand.grid(names(iris)[1:4], rev(names(iris)[1:4]), stringsAsFactors = FALSE)
splom_list <- vector("list", 16)

for(i in seq_along(splom_list)) {
  splom_list[[i]] <- figure(width = 200, height = 200, tools = tools, title = i) %>%
    ly_points(nms$Var1[i], nms$Var2[i], data = iris,
              color = Species, size = 5, legend = FALSE)
}

grid_plot(splom_list, nrow = 4, ncol = 4, same_axes = TRUE, link_data = TRUE)
grid_plot(splom_list, nrow = 4, ncol = 4, same_axes = TRUE, link_data = TRUE, byrow=F)

I get the same result, where I would expect to get something like matrix.

matrix(1:16,nrow=4,ncol=4,byrow=T)
     [,1] [,2] [,3] [,4]
[1,]    1    2    3    4
[2,]    5    6    7    8
[3,]    9   10   11   12
[4,]   13   14   15   16

matrix(1:16,nrow=4,ncol=4,byrow=F)
     [,1] [,2] [,3] [,4]
[1,]    1    5    9   13
[2,]    2    6   10   14
[3,]    3    7   11   15
[4,]    4    8   12   16

plot vectors

rbokeh requires all vectors to be converted to dataframes which increases the memory required. Also even if i want to plot just one point on a curve I have to put those points in a dataframe as well.

Please allow plotting of vectors and single points without requiring them to be in a dataframe

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.