facet

ElasticSearch group by multiple fields

大憨熊 提交于 2019-11-28 22:05:27
问题 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

can I change the position of the strip label in ggplot from the top to the bottom?

萝らか妹 提交于 2019-11-28 21:00:42
I know this is not quite a data visualization issue, but the boss asked for it, so I need to figure out if it is possible. Thanks! Dave An answer for those searching in 2016. As of ggplot2 2.0, the switch argument will do this for facet_grid or facet_wrap : By default, the labels are displayed on the top and right of the plot. If "x", the top labels will be displayed to the bottom. If "y", the right-hand side labels will be displayed to the left. Can also be set to "both". ggplot(...) + ... + facet_grid(facets, switch="both") As of ggplot2 2.2.0 , Strips can now be freely positioned in facet

What is 'Facet' in JavaEE?

半世苍凉 提交于 2019-11-28 17:44:34
I wonder not only what is Facet but also what is Facet 'in physical level' (as I understand it's not a separate jar, but what?)? I also wonder how can it affect my application after deploying. I'll explain on real example: I had 2 facets (which were created by IDE): Spring Facet and Web Facet (for jsf). I deployed it to Tomcat and my application worked fine. Then I added (by means of IDE) one more facet - JPA Facet. I redeployed application and.. it still worked fine :) So, I'm just curious what is that and why do we need it? This is not Java EE related. This is IDE related. The term is at its

Variable hline in ggplot with facet

谁说我不能喝 提交于 2019-11-28 11:46:39
Using the Iris data set as an example, I can produce a ggplot with facet. The code is: library(ggplot2) data(iris) y=iris y$Petal.Width.Range=factor(ifelse(y$Petal.Width<1.3,"Narrow","Wide")) y$Petal.Length.Range=factor(ifelse(y$Petal.Length<4.35,"Short","Long")) ggplot(y, aes(Sepal.Length,Sepal.Width)) + geom_point(alpha=0.5)+ geom_hline(yintercept =3 ,alpha=0.3)+ facet_grid(Petal.Width.Range ~ Petal.Length.Range) Here I have a horizontal spec of 3 in each of the 4 cases. What should I do if I want a case dependent spec please? For example, I can define 4 different specs as the following: y

ggplot2: More complex faceting

夙愿已清 提交于 2019-11-28 11:22:31
I have a heatmap that continues to become more and more complex. An example of the melted data: head(df2) Class Subclass Family variable value 1 A chemosensory family_1005117 caenorhabditis_elegans 10 2 A chemosensory family_1011230 caenorhabditis_elegans 4 3 A chemosensory family_1022539 caenorhabditis_elegans 10 4 A other family_1025293 caenorhabditis_elegans NA 5 A chemosensory family_1031345 caenorhabditis_elegans 10 6 A chemosensory family_1033309 caenorhabditis_elegans 10 tail(df2) Class Subclass Family variable value 6496 C class c family_455391 trichuris_muris 1 6497 C class c family

ggplot2: Using gtable to move strip labels to top of panel for facet_grid

限于喜欢 提交于 2019-11-28 09:22:50
I am creating a graphic using facet_grid to facet a categorical variable on the y-axis. I decided not to use facet_wrap because I need space = 'free' and labeller = label_parsed . My labels are long and I have a legend on the right so I would like to move the labels from the right of the panel to the top of the panel. Here is an example to show where I'm getting stuck. library(ggplot2) library(gtable) mt <- ggplot(mpg, aes(x = cty, y = model)) + geom_point() + facet_grid(manufacturer ~ ., scales = 'free', space = 'free') + theme_minimal() + theme(panel.margin = unit(0.5, 'lines'), strip.text.y

Annotating facet title as strip over facet

亡梦爱人 提交于 2019-11-28 04:46:34
I want to add a facet title as strip over a facetted plot in ggplot2 . My MWE throws an error. Any help will be highly appreciated. Thanks library(ggplot2) library(gtable) p <- ggplot(mtcars, aes(mpg, wt)) + geom_point() p <- p + facet_grid(. ~ cyl) # get gtable object Plot1 <- ggplot_gtable(ggplot_build(p)) # add label for top strip Plot1 <- gtable_add_rows(Plot1, Plot1$heights[[3]], 2) Plot1 <- gtable_add_grob(Plot1, list(rectGrob(gp = gpar(col = NA, fill = gray(0.5))), textGrob("Cyl", gp = gpar(col = gray(1)))), 3, 4, 3, 10, name = paste(runif(2))) # add margins Plot1 <- gtable_add_rows

Missing data when Supplying a Dual-axis--Multiple-traces to subplot

◇◆丶佛笑我妖孽 提交于 2019-11-28 02:27:57
Data is provided at the bottom of the question. I am trying to use subplot with plotly objects which one of them has multiple series in it. When I use subplot one of the series in the first graph does not show up in the final product. Look at the code below: library(plotly) library(dplyr) sec_y <- list(tickfont = list(color = "red"), overlaying = "y", side = "right", title = "Lft") pp1 <- fmean1 %>% group_by(grp) %>% plot_ly() %>% add_lines(x = ~hour, y = ~fmgd, name = "FMGD", colour = "blue") %>% add_lines(x = ~hour, y = ~lft, name = "Lft", yaxis = "y2", colour = "red") %>% layout(title =

How to use empty space produced by facet_wrap?

若如初见. 提交于 2019-11-27 20:50:19
I have a faceted plot that forms an n x m grid. By design, the last (bottom-right) cell is always empty, so I'd like to utilize the extra space by adding another ggplot object. My current solution relies on low-level viewport approach, which is not very elegant and requires some hard-coding for position and size. Instead, I assume the empty space is reachable in some other fashion, probably with gridExtra ? Here's a minimal example for n=m=2 . Note that the edges are not aligned properly, so some extra work is required to manually adjust viewport's parameters, which is a pain, especially if (n

Combining new lines and italics in facet labels with ggplot2

偶尔善良 提交于 2019-11-27 16:47:45
问题 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