What does do and when should I use it?

A facet represents a named section within a container component. For example, you can create a header and a footer facet for a dataTable component. https://web.archive.org/web/20170828020413/http://www.jsftoolbox.com/documentation/help/12-TagReference/core/f_facet.html It’s useful when you want to create component that uses some code from user (let’s say wrapper). ie. when you want to create component that hides long text and … Read more

ElasticSearch group by multiple fields

Starting from version 1.0 of ElasticSearch, the new aggregations API allows grouping by multiple fields, using sub-aggregations. Suppose you want to group by fields field1, field2 and field3: { “aggs”: { “agg1”: { “terms”: { “field”: “field1” }, “aggs”: { “agg2”: { “terms”: { “field”: “field2” }, “aggs”: { “agg3”: { “terms”: { “field”: “field3” … Read more

How do you add a general label to facets in ggplot2?

As the latest ggplot2 uses gtable internally, it is quite easy to modify a figure: library(ggplot2) test <- data.frame(x=1:20, y=21:40, facet.a=rep(c(1,2),10), facet.b=rep(c(1,2), each=20)) p <- qplot(data=test, x=x, y=y, facets=facet.b~facet.a) # get gtable object z <- ggplotGrob(p) library(grid) library(gtable) # add label for right strip z <- gtable_add_cols(z, unit(z$widths[[7]], ‘cm’), 7) z <- gtable_add_grob(z, list(rectGrob(gp = … Read more

Setting individual axis limits with facet_wrap and scales = “free” in ggplot2

Here’s some code with a dummy geom_blank layer, range_act <- range(range(results$act), range(results$pred)) d <- reshape2::melt(results, id.vars = “pred”) dummy <- data.frame(pred = range_act, value = range_act, variable = “act”, stringsAsFactors=FALSE) ggplot(d, aes(x = pred, y = value)) + facet_wrap(~variable, scales = “free”) + geom_point(size = 2.5) + geom_blank(data=dummy) + theme_bw()

How to change facet labels?

Here is a solution that avoids editing your data: Say your plot is facetted by the group part of your dataframe, which has levels control, test1, test2, then create a list named by those values: hospital_names <- list( ‘Hospital#1’=”Some Hospital”, ‘Hospital#2’=”Another Hospital”, ‘Hospital#3’=”Hospital Number 3″, ‘Hospital#4’=”The Other Hospital” ) Then create a ‘labeller’ function, and … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)