# examples from ggplot2 book # http://www.amazon.com/ggplot2-Elegant-Graphics-Data-Analysis/dp/0387981403/ref=sr_1_1?ie=UTF8&qid=1423697224&sr=8-1&keywords=ggplot2 library(rbokeh) library(ggplot2) data(diamonds) bp <- figure( height = 400, width = 700 ) bp %>% ly_points(carat,price,diamonds,color=cut,size=5) # add hover bp %>% ly_points(carat,price,diamonds,color=cut,size=1,hover=list(cut,clarity,color)) # make it a hexbin bp %>% ly_hexbin( carat, price, diamonds ) # make it a hexbin with facet by color lapply( levels(unique(diamonds$color)) ,function(c){ figure( height = 300, width = 300, title = paste0("Color: ",c) ) %>% ly_hexbin( carat, log(price), diamonds[which(diamonds$color==c),] ) } ) %>% grid_plot( nrow = 3, ncol = 3, same_axes = T ) # histogram on diamonds bp %>% ly_hist( x = carat, data = diamonds, breaks = 2 ) # density on diamonds bp %>% ly_density( x = carat, data = diamonds ) # quantile on diamonds bp %>% ly_quantile(price,group = "color", diamonds) bp %>% ly_quantile(price,group = "color", diamonds, distn=qnorm) #demo a transform bp %>% ly_points( cyl, mpg^2, mtcars ) %>% # not transformed ly_points( cyl, mpg, mtcars, color = "red" ) %>% # axis need to come after layers specified y_axis( log = T ) # set vs map color bp %>% ly_points( mpg, wt, mtcars, color = "purple") bp %>% ly_points( mpg, wt, data.frame(name=rownames(mtcars),mtcars), color = cyl, hover = list(name)) # boxplot data("Oxboys", package = "nlme") bp %>% ly_boxplot( Occasion, height, Oxboys )