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
303
votes
23 answers

How to change facet labels?

I have used the following ggplot command: ggplot(survey, aes(x = age)) + stat_bin(aes(n = nrow(h3), y = ..count.. / n), binwidth = 10) + scale_y_continuous(formatter = "percent", breaks = c(0, 0.1, 0.2)) + facet_grid(hospital ~ .) +…
wishihadabettername
  • 14,231
  • 21
  • 68
  • 85
220
votes
6 answers

Annotating text on individual facet in ggplot2

I want to annotate some text on last facet of the plot with the following code: library(ggplot2) p <- ggplot(mtcars, aes(mpg, wt)) + geom_point() p <- p + facet_grid(. ~ cyl) p <- p + annotate("text", label = "Test", size = 4, x = 15, y =…
MYaseen208
  • 22,666
  • 37
  • 165
  • 309
164
votes
3 answers

Setting individual axis limits with facet_wrap and scales = "free" in ggplot2

I'm creating a facetted plot to view predicted vs. actual values side by side with a plot of predicted value vs. residuals. I'll be using shiny to help explore the results of modeling efforts using different training parameters. I train the model…
Hendy
  • 10,182
  • 15
  • 65
  • 71
154
votes
7 answers

Fixing the order of facets in ggplot

Data: df <- data.frame( type = c("T", "F", "P", "T", "F", "P", "T", "F", "P", "T", "F", "P"), size = c("50%", "50%", "50%", "100%", "100%", "100%", "150%", "150%", "150%", "200%", "200%", "200%"), amount = c(48.4, 48.1, 46.8, 25.9,…
samarasa
  • 2,025
  • 2
  • 16
  • 22
120
votes
2 answers

Change the position of the strip label in ggplot from the top to the bottom?

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.
lokheart
  • 23,743
  • 39
  • 98
  • 169
98
votes
6 answers

How do you add a general label to facets in ggplot2?

I often have numeric values for faceting. I wish to provide sufficient information to interpret these faceting values in a supplemental title, similar to the axis titles. The labeller options repeat much unnecessary text and are unusable for longer…
Etienne Low-Décarie
  • 13,063
  • 17
  • 65
  • 87
62
votes
1 answer

R ggplot2 legend inside the figure

So, I have the following data.frame, and I want to generate two plots in one graph for yval vs. xval, for each zval and type tp. The lef > df xval yval se zval cond 1 1.0 1.831564e-02 1.831564e-03 0 a 2 1.2…
Vahid Mirjalili
  • 6,211
  • 15
  • 57
  • 80
61
votes
4 answers

What is 'Facet' in JavaEE?

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…
Roman
  • 64,384
  • 92
  • 238
  • 332
58
votes
1 answer

What does do and when should I use it?

I have been having trouble with the tag . I am working form other examples of code which use it, but I'm not sure exactly what purpose it serves. I have written some code which in method is exactly the same as other code I have seen which…
hello123
  • 951
  • 2
  • 15
  • 25
57
votes
4 answers

ElasticSearch group by multiple fields

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,…
Pavel
  • 964
  • 1
  • 6
  • 18
55
votes
2 answers

How to add different lines for facets

I have data where I look at the difference in growth between a monoculture and a mixed culture for two different species. Additionally, I made a graph to make my data clear. I want a barplot with error bars, the whole dataset is of course bigger,…
Marinka
  • 1,189
  • 2
  • 11
  • 24
44
votes
6 answers

Add x and y axis to all facet_wrap

It is often desirable to minimize ink in a plot. I have a faceted plot (facet_wrap) and would like to remove as much ink as possible yet maintain readability. I have set it up as I'd like except the x and y axis is not present for the facets…
Tyler Rinker
  • 108,132
  • 65
  • 322
  • 519
44
votes
9 answers

Project facet Java version 1.7 is not supported

When i update my java I found the issue "Project facet Java version 1.7 is not supported" To resolve this issue follow the steps. Go to Ecllipse , right click on your project folder select the properties now select Project Facets ,here you will…
Imran khan
  • 819
  • 3
  • 12
  • 24
44
votes
1 answer

different size facets proportional of x axis on ggplot 2 r

The following is a situation: group1 <- seq(1, 10, 2) group2 <- seq(1, 20, 3) x = c(group1, group2) mydf <- data.frame (X =x , Y = rnorm (length (x),5,1), groups = c(rep(1, length (group1)), rep(2, length(group2)))) ggplot(mydf, aes(X, Y, group=…
jon
  • 11,186
  • 19
  • 80
  • 132
41
votes
2 answers

Nested facets in ggplot2 spanning groups

I encountered a situation in which I want to create a plot that was facetted by three grouping variables. To do so, I would simply use facet_grid(f1 ~ f2 + f3), but the issue here is that the labels for f2 would be redundant, and it would be much…
ZNK
  • 2,196
  • 1
  • 19
  • 25
1
2 3
99 100