Questions tagged [facet]

Facetting is a technique for data visualization which makes it easier to compare groups inside your data.

Facet

In the ggplot2 package for R, creating subplots for groups of data is called facetting. When visualizing data, facetting allows groups of data to be rendered alongside each other in order to make it easier to compare them. A facetted plot can be made with facet_wrap() and facet_grid().

Resources

1763 questions
21
votes
4 answers

ggplot, facet, piechart: placing text in the middle of pie chart slices

I'm trying to produce a facetted pie-chart with ggplot and facing problems with placing text in the middle of each slice: dat = read.table(text = "Channel Volume Cnt AGENT high 8344 AGENT medium …
topchef
  • 19,091
  • 9
  • 63
  • 102
20
votes
5 answers

Eclipse Warning: Unknown Faceted Project

I have a parent Maven project (using java facet version 1.7) which includes some modules. I got the following warning from Eclipse Juno SR1: Implementation of project facet java could not be found. Functionality will be limited (Unknown Faceted…
jilt3d
  • 3,864
  • 8
  • 34
  • 41
19
votes
1 answer

Annotating facet title as strip over facet

I want to add a facet title as strip over a facetted plot in ggplot2. My MWE throws an error. library(ggplot2) library(gtable) p <- ggplot(mtcars, aes(mpg, wt)) + geom_point() p <- p + facet_grid(. ~ cyl) # get gtable object Plot1 <-…
MYaseen208
  • 22,666
  • 37
  • 165
  • 309
18
votes
2 answers

passing comma separated values in filter query of solr response

I want to pass comma separated values in filter query (fq) of solr response, currently when i want to pass multiple categories i use OR operator. like this fq=categoryId:3 OR categoryId:55 OR categoryId:34 is there any solution to pass values like…
goblin2986
  • 971
  • 3
  • 16
  • 32
17
votes
4 answers

ggplot: Order bars in faceted bar chart per facet

I have a dataframe in R that I want to plot in a faceted ggplot bar chart. I use this code in ggplot: ggplot(data_long, aes(x = partei, y = wert, fill = kat, width=0.75)) + labs(y = "Wähleranteil [ % ]", x = NULL, fill = NULL) + …
Mario
  • 2,393
  • 2
  • 17
  • 37
16
votes
1 answer

Ownership/delete'ing the facet in a locale (std::locale)

I wrote the following function to get a date/time string using boost.date_time. namespace bpt = boost::posix_time; string get_date_time_string(bpt::ptime time) { bpt::time_facet * facet(new bpt::time_facet); facet->format("%Y%m%d%H%M%S"); …
decimus phostle
  • 1,040
  • 2
  • 13
  • 28
16
votes
3 answers

Show x-axis and y-axis for every plot in facet_grid

As similar question has been asked before (here) but I can't adjust the solution provided there to my specific problem. For every plot shown below, there should be a x as well as y-axis. The data: df_nSubj <- data.frame( nSubj = rep(seq(10L, 50L,…
beginneR
  • 3,207
  • 5
  • 30
  • 52
15
votes
3 answers

ggplot2::coord_cartesian on facets

coord_cartesian doesn't allow one to set per-facet coordinates, and using other range-limiting tends to produce a straight-line on the specific extreme. Since we have widelay-varying y-ranges, we can't set the limits on all facets identically;…
r2evans
  • 141,215
  • 6
  • 77
  • 149
15
votes
1 answer

How to order data by value within ggplot facets

I have the following data frame: library(tidyverse) tdat <- structure(list(term = c("Hepatic Fibrosis / Hepatic Stellate Cell Activation", "Cellular Effects of Sildenafil (Viagra)", "Epithelial Adherens Junction Signaling", "STAT3 Pathway",…
littleworth
  • 4,781
  • 6
  • 42
  • 76
15
votes
3 answers

R Changing Order of Facets

I am trying to change the order of the facets from BA, SLG to SLG, BA. I have found questions similar to this but I think my solution might not be working because I have summarized the data in excel; Therefore, my data frame might be different.…
Remy M
  • 599
  • 1
  • 4
  • 17
15
votes
1 answer

Is it possible to do Solr faceting combining multiple fields, like distinct on multiple columns in RMDB?

Let's say I want to do faceting on the combination of two fields in my doc. For example: Field1 Field2 A B C D A B A C C B C D Will have the facet result like AB [2] CD [2] AC [1] CB [1] Is this possible?…
BruceCui
  • 731
  • 1
  • 6
  • 11
14
votes
2 answers

Plotly: How to hide axis titles in a plotly express figure with facets?

Is there a simple way to hide the repeated axis titles in a faceted chart using plotly express? I tried setting visible=True In the code below, but that also hid the y axis tick labels (the values). Ideally, I would like to set hiding the…
Randall Goodwin
  • 1,916
  • 2
  • 18
  • 34
14
votes
2 answers

Add hline with population median for each facet

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…
mattek
  • 903
  • 1
  • 6
  • 18
14
votes
3 answers

Solr faceting: Inconsistent JSON formatting

I have the following two fields in my solr schema: When I make a request with facets enabled (faceting…
mjalajel
  • 2,171
  • 21
  • 27
13
votes
2 answers

How can I move facet labels to top of my graph?

I can create a faceted plot like so, with 3 plots stacked vertically: ggplot(iris, aes(Petal.Length)) + stat_bin() + facet_grid(Species ~ .) Is it possible to move the labels to the top of each graph, like they would be if I'd done horizontal…
Ken Williams
  • 22,756
  • 10
  • 85
  • 147