facet

ElasticSearch group by multiple fields

寵の児 提交于 2019-11-30 01:20:25
The only close thing that I've found was: Multiple group-by in Elasticsearch Basically I'm trying to get the ES equivalent of the following MySql query: select gender, age_range, count(distinct profile_id) as count FROM TABLE group by age_range, gender The age and gender by themselves were easy to get: { "query": { "match_all": {} }, "facets": { "ages": { "terms": { "field": "age_range", "size": 20 } }, "gender_by_age": { "terms": { "fields": [ "age_range", "gender" ] } } }, "size": 0 } which gives: { "ages": { "_type": "terms", "missing": 0, "total": 193961, "other": 0, "terms": [ { "term": 0

Normalizing faceted histograms separately in ggplot2

南笙酒味 提交于 2019-11-29 18:03:00
问题 My questions is similar to Normalizing y-axis in histograms in R ggplot to proportion but I'd like to add to it a bit. In general, I have 6 histograms in a 2x3 facet design, and I'd like to normalize each of them separately. I'll try to make a sample data set here to give an idea: hvalues=c(3,1,3,2,2,5,1,1,12,1,4,3) season=c("fall","fall","fall","fall","winter","winter","winter","winter","summer","summer","summer","summer") year=c("year 1","year 1","year 2","year 2","year 1","year 1","year 2"

how to set limits on rounded facet wrap y axis?

旧街凉风 提交于 2019-11-29 14:37:29
问题 I have this plot and I need to round the y axis so what appears is acceptable EXCEPT for the fact that I would like to not just show 1 value on the y axis. I'd like to add the "limit" to the "scale_y_continuous" function so that the limits for each facet plot are unique to the individual facet. here is the plot only showing 60 and 80 on the y axis dat = data.frame(x = c(1,2,3,1,2,3),A=c(80.6, 82,83,60,61,62),A_up =c(81,84,85,62,63,64), A_low =c(79,78,81,59,58,57), group = c("z","z","z","y","y

How to position annotate text in the blank area of facet ggplot

廉价感情. 提交于 2019-11-29 14:09:20
How to annotate some text in the blank space within a odd numbered faceted ggplot. Lets have a faceted ggplot with data as below with with 2 rows and 2 columns. So there is blank space in place of 2 row, 2nd column. df<- data.frame(Ara = rep("XTX", each = 3), Len = c(744, 750, 755), Mon = c("Sep", "Oct","Nov"), Value=c(11.224,10.15,4.23)) df facetplot<-ggplot(df, aes(x=Value, y=Len, shape=Ara))+ geom_point(size=5.0)+ theme(legend.position = c(.7, .4), legend.direction="vertical")+ facet_wrap(~Mon,scales="free_x", nrow=2) facetplot Now i am trying to annotate some text in the space but could

'Labels on top' with facet_grid, or 'space option' with facet_wrap

微笑、不失礼 提交于 2019-11-29 14:04:36
facet_grid allow me to size each facet width according to number of items on y axis ( space argument): df <- data.frame(label = c("Variable one", rep("Variable two", 2), rep("Variable three", 3)), item = c("A", "B", "C", "D", "E", "F"), value = rnorm(6)) ggplot(df, aes(x = value, y = item)) + geom_point() + facet_grid(label ~ ., scales = "free_y", space = "free_y") + ylab("") + theme(strip.text.y = element_text(angle=0)) But I would like facet labels on top, so I switch to facet_wrap , and lost the space argument (facets have all the same width): ggplot(df, aes(x = value, y = item)) + geom

open source faceted search / guided navigation for ecommerce sites with .net apis

梦想与她 提交于 2019-11-29 12:46:46
i am looking for open source libraries which provide high performance faceted search / guided navigation for ecommerce sites our ecommerce platform is entirely built on .net and so i would prefer libraries which do provide .net apis performance is of utmost importance here... i checked out sphinx as well as solr but looking for better options as far as performance goes as per blogs sphinx takes an average of 5 - 6 seconds to perform the first level of faceted search which is unacceptable in a real ecommerce environment Apache Solr is exactly what you are looking for. Is a full-fledged search

How to use different font sizes in ggplot facet wrap labels?

一个人想着一个人 提交于 2019-11-29 09:53:34
I want to create two different sizes of text in the labels of my facet wrap. For example: Species X (size 14) Total catch (n=133) (size 12) test <- read.csv(paste0(path, "Costello Artvgl2 for Stack.csv"), sep = ";", dec = ",", header = T) str(test) test$Wert <- factor(test$Wert, levels = c("one","two","three","four","five","six")) test$Sampling.site <- factor(test$Sampling.site, levels = c("Species X Area T","Species Y Area T","Species X Area A","Species Y Area B","Species X Area B","Species Y Area C")) levels(test$Sampling.site) <- c("Species X\nTotal catch (n=133)", "Species Y\nTotal catch

Add hline with population median for each facet

浪子不回头ぞ 提交于 2019-11-29 06:34:24
I'd like to plot a horizontal facet-wide line with the population median of that facet. I tried the approach without creating a dummy summary table with the following code: require(ggplot2) dt = data.frame(gr = rep(1:2, each = 500), id = rep(1:5, 2, each = 100), y = c(rnorm(500, mean = 0, sd = 1), rnorm(500, mean = 1, sd = 2))) ggplot(dt, aes(x = as.factor(id), y = y)) + geom_boxplot() + facet_wrap(~ gr) + geom_hline(aes(yintercept = median(y), group = gr), colour = 'red') However, the line is drawn for the median of the entire dataset instead of the median separately for each facet: In the

Combining new lines and italics in facet labels with ggplot2

我们两清 提交于 2019-11-29 02:25:18
I have a problem getting some words used in facet labels in italics. I use the following code to create new lines for the labels: levels(length_subject$CONSTRUCTION) <- c("THAT \n Extraposed", "THAT \n Post-predicate", "TO \n Extraposed \n for-subject", "TO \n Post-predicate \n for-subject", "THAT \n Extraposed \n that-omission", "THAT \n Post-predicate \n that-omission") However, I want the words "that" and "for" to appear in italics. I've tried something like "TO \n Extraposed \n (italics(for))-subject" bit it doesn't work. This is what the plots look like: produced with the following code:

how to change strip.text labels in ggplot with facet and margin=TRUE

雨燕双飞 提交于 2019-11-28 22:07:02
I have looked here but still can't figure it out. How do I change the strip.text.x labels in a ggplot with faceting? Specifically I am using facet_grid with margins. The strip.text label for the margin is "(all)" - but since I am in a non-english speaking country I would rather write "Total" or something similar in my native tongue. opts(stip.text.x=c(levels(facetvariabel,"Total")) does not work. Any ideas? Example (not really the best dataset for this - but I guess it will work) ggplot(cars, aes(x=dist))+geom_bar()+facet_grid(.~speed, margin=T) kohske You can customize the facet labels by