facet

Internal ordering of facets ggplot2

£可爱£侵袭症+ 提交于 2019-12-12 15:30:15
问题 I'm trying to plot a facets in ggplot2 but I struggle to get the internal ordering of the different facets right. The data looks like this: head(THAT_EXT) ID FILE GENRE NODE 1 CKC_1823_01 CKC Novels better 2 CKC_1824_01 CKC Novels better 3 EW9_192_03 EW9 Popular Science better 4 H0B_265_01 H0B Popular Science sad 5 CS2_231_03 CS2 Academic Prose desirable 6 FED_8_05 FED Academic Prose certain str(THAT_EXT) 'data.frame': 851 obs. of 4 variables: $ ID : Factor w/ 851 levels "A05_122_01","A05_277

Fixing plot area width when using layout_matrix in grid.arrange

孤街醉人 提交于 2019-12-12 12:41:04
问题 I am combining facet plots of tiles. I want each tile to be square, or at least take the same height and width. So far I have managed to give equal height to each row of tiles using layout_matrix . I am stuck when trying to fix an equal width to each column of tiles (across the plots). Some code based on mtcars to try and illustrate the layout of my plot (actual data way more complicated): library("tidyverse") library("gridExtra") df0 <- mtcars %>% group_by(cyl) %>% count() df1 <- mtcars %>%

parsed labels along one facet axis, unparsed labels along the other

五迷三道 提交于 2019-12-12 12:02:43
问题 I'm trying to find a convenient solution to a scenario where I have multi-line, plain-text labels for one faceting dimension and plotmath-style math expressions for the other faceting dimensions. The various solutions to multi-line strip labels (such as here) are a bit clunky for my case; I have factor labels in snake_case and want to be able to convert them all to multiline versions programmatically without descending into substitute(bquote(parse(...)) hell (although solutions along those

ggplot2 facet wrap: y-axis scale on the first row only

妖精的绣舞 提交于 2019-12-12 11:03:54
问题 Is it possible to add a y-axis to a facet wrap, but only for the first row, as shown in the screenshot? Code for my plot: library(ggplot2) mydf <- read.csv('https://dl.dropboxusercontent.com/s/j3s5sov98q9yvcv/BPdf_by_NB') ggplot(data = mydf) + geom_line(aes(x = YEARMONTH, y = NEWCONS, group = 1), color="darkseagreen3") + geom_line(aes(x = YEARMONTH, y = DEMOLITIONS, group = 1), color = "black") + theme_minimal() + labs(title="New constructions Vs Demolitions (2010 - 2014)\n") + theme( axis

facet_grid returns error message in ggplot

核能气质少年 提交于 2019-12-12 05:49:39
问题 I have composed code that creates density plots but when I try to combine them with facet_grid I get error messages. For reproducible examples see bellow using mtcars (base R) library(data.table) library(ggplot2) library(ggthemes) data(mtcars) setDT(mtcars) mtcars[, am := factor(am, levels = c(1, 0))] mean_data <- mtcars[, .(mu = mean(hp)), by = am] p1 <- ggplot(mtcars, aes(x = hp, fill = am , color = am)) + geom_histogram(aes(y=..density..), position="identity",alpha = 0.4) + guides(color =

Solr DIH with multi value fields and faceting

浪子不回头ぞ 提交于 2019-12-12 04:31:49
问题 I’ m using Solr to index a dataset stored in DBMS using SQL DIH. One on the table use a n-to-n relationship. Just for sake of simplicity (my app is much more complex than this) here is an example of the application: a person has a name and it has associated 0..n roles (a role is described by a role_name string). Table Person: - id: int - Name: string Table roles - id: int - role_name: string Table association - id_person: int - id_role: int Two persons could be described as: id=1, name=John

SOLR facet search by prefix with results highlighting

旧城冷巷雨未停 提交于 2019-12-11 18:53:09
问题 Can I search via facet by prefix with results highlighting? For example I have 2 documents: name = "document1" title = "Simple query" name = "document2" title = "Simple queries" can I searching documents with prefix "quer"? And can I highlight returned results? 回答1: facet.prefix just limits the terms on which to facet to those starting with the given string prefix. This does not effect or change the search results, it simply reduces the facet values returned to those beginning with the

facet_wrap add geom_hline

好久不见. 提交于 2019-12-11 15:14:24
问题 I have the following code for my ggplot - the facet_wrap function draws out 20 plots on the page for each Name and there are 5 Pcode along the x-axis. I would like to calculate the average TE.Contr for each Name and plot that value as a horizontal line on each of the plots (which are split out by Facet_wrap). Currently my codes plots the average of ALL TE.Contr. values instead of the average TE.Contr. of the specific Name. T<-ggplot(data = UKWinners, aes(x = Pcode, y = TE.Contr., color =

Hibernate Search: configure Facet for custom FieldBridge

为君一笑 提交于 2019-12-11 13:13:56
问题 In this example DateSplitBridge.java dynamic fields are added to indexed document: public class DateSplitBridge implements FieldBridge { ... public void set(String name, Object value, Document document, LuceneOptions luceneOptions) { ... luceneOptions.addFieldToDocument( name + ".year", String.valueOf( year ), document); ... How do I configure Facet for such ad hoc fields? Can it be done in FieldBridge itself? 回答1: Solution was found in https://hibernate.atlassian.net/browse/HSEARCH-1686?page

Find all co authors - Faceting/Grouping for many to many mapping table

落花浮王杯 提交于 2019-12-11 13:11:21
问题 Table : Books ------------- ID Name 1 Book1 2 Book2 3 Book3 4 Book4 Table : Authors ------------- ID Name 1 Author1 2 Author2 3 Author3 4 Author4 Table : BookAuthorMapping --------------------------- ID BookId AuthorId 1 1 1 2 1 2 3 1 3 4 2 2 5 2 3 6 3 3 7 4 4 So, Book1 is written by Author1,Author2,Author3 Book2 is written by Author2,Author3 Book3 is only written by Author3 Book4 is only written by Author4 The problem is : Given an AuthorId, I need to find out How many books did other