FAQ Database Discussion Community


ElasticSearch filtering on multiple fields (with aggregration)

json,elasticsearch,nosql,facet
I am building a faceted filtering function for a webshop, something like this: Filter on Brand: [ ] LG (10) [ ] Apple (5) [ ] HTC (3) Filter on OS: [ ] Android 4 (11) [ ] Android 5 (2) [ ] IOS (5) I am using aggregation and...

R ggplot : Can't change y-axis scale range with facetted plot

r,ggplot2,facet
I have a simple problem but I can't figure out why it won't work -> I can't adjust the y scale range on my faceted bar plot: # Data # df<-as.data.frame(c("x","y","z","x","y","z","x","y","z","x","y","z")) colnames(df)<-"x" df$y<-c(10,15,20,5,25,45,10,10,20,40,20,5) df$facet<-c(1,1,1,1,1,1,2,2,2,2,2,2) df$group<-c("A","A","A","B","B","B","A","A","A","B","B","B") # Plot # ggplot(df, aes(x=x, y=y, fill=group)) + facet_grid( ~ facet) + scale_fill_manual(values=c("blue", "red")) +...

geom_text and facets not working

r,ggplot2,facet
Data file is way to big to dput but I am hoping that somebody will be able to identify my error. Here is the story: I produced the following small multiples plot using ggplot with the following code. Everything is working just fine. ggplot(sm.df, aes(year, N, group = 1)) +...

Three-way graph (variable, mean, sd) with ggplot2

r,ggplot2,mean,facet,standard-deviation
I think I have an error in my logic while reproducing a graph I found in this pdf here. It should be fairly easy to do, but I have issues to plot a variable with its mean and standard deviation each in their own graph together, as can be seen...

Plotting percent change for a large number of factors on same figure using ggplot by faceting or color-coding factors

r,graphics,ggplot2,facet,facet-wrap
Here is an example of the code I'm working with x<-as.factor(rep(c("tree_mean","tree_qmean","tree_skew"),3)) factor<-c(rep("mfn2_burned_99",3),rep("mfna_burned_5_7",3),rep("mfna_burned_5_7_10_12",3))) y<-c(0.336457409,-0.347422910,-0.318945621,1.494109367, 0.003578698,-0.019985780,-0.484171146, 0.611589217,-0.322292664) dat<-as.data.frame(cbind(x,factor,y)) head(dat) x factor y tree_mean mfn2_burned_99 -0.3364574 tree_qmean mfn2_burned_99 -0.3474229 tree_skew mfn2_burned_99 -0.3189456 tree_mean mfna_burned_5_7...

R using ggplot2: “Error in value == ”primary“ : comparison is not allowed for expressions”

r,ggplot2,facet
I am attempting to change the labels in the handy facet plot available in R with ggplot using a function that I created, facet_labeller: #This function will map a new name to the category labels facet_labeller <- function(var, value){ value <- as.character(value) # Creates labels with superscript for 1st and...

Set categorical axis labels with scales “free” ggplot2

r,plot,ggplot2,facet
I am trying to set the labels on a categorical axis within a faceted plot using the ggplot2 package (1.0.1) in R (3.1.1) with scales="free". If I plot without manually setting the axis tick labels they appear correctly (first plot), but when I try to set the labels (second plot)...

Defining Colors in a grouped/faceted scatterplot in R using ggplot2

r,plot,ggplot2,scatter-plot,facet
I'm pretty new to the world of R, so please be patient with me ;-) For the last two weeks I've been playing with an old dataset of mine, trying to figure out some stuff in R. What you need to know about my data to help me here, is...

How to get grouped facet result from Amazon CloudSearch with structured query

amazon,group,facet,amazon-cloudsearch
I am trying to get grouped facet information in following situation : When query requests cars with certain makes (e.g) HONDA or MAZDA), with make and model facet information then query would be like q={or "make":"HONDA" "make":"MAZDA"}&facet.make={}&facet.model={} Then, its facet result would be like: "make" : { "buckets" : [{...

drawing line segments connecting sets of points

r,ggplot2,line,facet,segment
I am trying to connect sets of (two) points at each level of x, in each facet. Here is a reproducible example: datum <- structure(list(frequency = c(8L, 7L, 6L, 18L, 5L, 11L, 16L, 15L, 9L, 8L, 8L, 10L, 2L, 20L, 14L, 3L, 6L, 2L, 2L, 11L, 10L, 6L, 15L, 19L,...

What is the difference between composite:insertFacet and composite:renderFacet?

jsf,jsf-2,composite-component,facet
I am using GlassFish 3.1.2 and trying to use composite:insertFacet in a composite component, but the HTML Markup is not generated when using my CC. The same code works fine when I use composite:renderFacet, but I want to understand why composite:insertFacet is not working in that example? and when to...

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

r,ggplot2,facet,gtable
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...

Conditionally change ggplot facet background with date axis

r,ggplot2,facet
Using facet_grid with ggplot, I'm trying to conditionally change the background of some the panels, to highlight ones of interest I've identified. I'm trying to achieve this following the answer from a similar question here. I understand the idea is to plot a geom_rect layer with opacity first to act...

Reorder X variable based on Facet variable

r,ggplot2,facet
I'm creating a facet grid. I'm attempting to reverse the order of levels on the x-axis (Context) based on the level of the specified facet variable(.~Order). (E.g., For Order, if "NFF", then order of Context = "NF", "IF"; if "IFF", then order of Context = "IF", "NF"). Edit Data I'm...

How to draw a ggplot2 with facet_wrap, showing percentages from each group, not overall percentages?

r,ggplot2,percentage,facet
I'd like to draw a ggplot with facet_wrap, which doesn't show the actual table percent, but the percent of the given answer in each group. I have to do this, because I want to show, which answer is most selected and most important for each group. The groups don't have...

R, ggplot2, facetted histogram, decending order, factor x-axis labels

r,ggplot2,order,facet
I have an interesting problem where I need to produce a facetted histogram series which I want to put in decending order for each panel. This below code replicates the problem. library(ggplot2) set.seed(1) nGroup = 10; nSample = 10 df <- data.frame(Group=rep(1:nSample,nGroup), Category = factor(sample(LETTERS, nGroup*nSample, replace=TRUE), levels=LETTERS), Amount =...

GCC, std::ctype specialisation & streams

c++,unicode,locale,iostream,facet
I've written my own specialisation of each virtual member function of std::ctype<char16_t>, so that this now works: #include <string> #include <locale> #include "char16_facets.h" // Header containing my ctype specialisation #include <sstream> #include <iostream> // Implemented elsewhere using iconv std::string Convert(std::basic_string<char16_t>); int main() { std::basic_string<char16_t> s("Hello, world."); std::basic_stringstream<char16_t> ss(s); ss.imbue(std::locale(ss.getloc(), new...

Horizontal barplot in ggplot2 with faces having different categories

r,ggplot2,bar-chart,facet
I have a data frame with ids, categories, and values, while I manage easily to have an horizontal dot-plot, with products grouped by category in distinct facets, when I try with a barplot, event categories with missing data show up. Any hint? Is it a bug or am I missing...

ggplot2 and first data point in a line

r,ggplot2,facet
I am creating two plots using ggplot2 and then using grid.arrange to merge them together. I should say that both of the plots are also using facet_grid for a visual tweaking. My problem is that the bottom plot, which is really a data table, ends up being "cut off" on...

Solr facet on subset of documents

solr,facet
I have Solr documents that can have 3 possible states (state_s in {new, updated, lost}). These documents have a field named ip_s. These documents also have a field nlink_i that can be equal to 0. What I want to know is: how many new ip_s I have. Where I consider...

How do I combine Facet and FilterQueries using Spring data Solr?

spring,solr,filtering,facet
Is it possible to combine a facet and field query in spring data solr? Something that would build a query like this: > http://localhost:8983/solr/myCore/select?q=lastName%3AHarris*&fq=filterQueryField%3Ared&wt=json&indent=true&facet=true&facet.field=state In other words, how do I add FilterParameters to a SimpleFacetQuery? Any/all replies welcome, thanks in advance, -- Griff...

plot lmer result in faceted ggplot

r,ggplot2,facet,lmer
I'm analysing some repeated measures drug trials data and I'm not sure how to plot the lmer results when using faceted ggplots. I have made an initial plot of the individual slopes from the master dataset, but I'm doing the lmer analyses separately by sex. Using publicly available data, which...

r ggplot2 annotate pointrange and segment in single facet

r,ggplot2,facet
I am creating a 3 facet plot with ggplot with the following data library(ggplot2) test<-as.data.frame(c(1,2,3,4,1,2,3,4,1,2,3,4)) colnames(test)<-"e12" test$e23<-c(NaN,NaN,NaN,NaN,2,3,4,5,2,3,4,5) test$e34<-c(NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,3,4,5,6) test$Age<-c(1,2,3,4,1,2,3,4,1,2,3,4) test$facet<-c(1,1,1,1,2,2,2,2,3,3,3,3) ggplot(test, aes(x=Age)) + facet_grid( ~ facet) + geom_line(aes(y = e12), size=0.25, colour="red", linetype="dashed") + geom_point(aes(y = e12), size=2.5, shape=21, fill="red", colour=NA) +...