Questions tagged [facet-grid]

Facet grid is a presentation form which includes panels defined by facetting variables. Facet grid is allowed to show all existed combinations of the concerned variables to reveal relationships between them.

Facet grid is a presentation form which includes panels defined by facetting variables. Facet grid is allowed to show all existed combinations of the concerned variables to reveal relationships between them.

Some graph packages have facet grid plotting tools:

: ggplot2 facet_grid examples

: seaborn FacetGrid examples

642 questions
7
votes
3 answers

How to increase the font size of the FactorPlot/FacetGrid legend

The instructions from this question don't work for Seaborn FacetPlots. Would it be possible to get the method to do the same?
tangy
  • 3,056
  • 2
  • 25
  • 42
7
votes
1 answer

geom_smooth with facet_grid and different fitting functions

First of all, apologies for the example, but I couldn't find a better data set to demonstrate the problem. Hopefully, it will suffice. Say I'm trying to make a facet grid of transmission (automatic vs. manual) and number of gears from the mtcars…
Dan
  • 11,370
  • 4
  • 43
  • 68
6
votes
3 answers

How to add additional plots to a seaborn FacetGrid and specify colors

Is there a way to create a Seaborn line plot with all the lines gray and the mean as a red line? I'm trying to do this with relplot but I don't know how to separate the mean from the data (and it appears the mean isn't being plotted?). Make…
a11
  • 3,122
  • 4
  • 27
  • 66
6
votes
2 answers

Seaborn FacetGrid, how to show y tick labels in all subplots

In a Seaborn FacetGrid, how can I get the y-axis tick labels to show up in all the subplots, regardless of whether or not sharey=True? tips = sns.load_dataset("tips") g = sns.FacetGrid(tips, col="time", row="sex") g.map(sns.scatterplot,…
a11
  • 3,122
  • 4
  • 27
  • 66
6
votes
1 answer

Highlight / Draw a box around some of the plots when using `facet_grid` in ggplot2

I am creating a matrix of plots similar to ggplot(mpg, aes(displ, hwy)) + geom_point() + facet_grid(rows = vars(cyl), cols = vars(drv)) Now, I would like to have some way to highlight some of the individual plots, say the ones where cyl is 5 or 6,…
user3825755
  • 883
  • 2
  • 10
  • 29
6
votes
2 answers

get rid of empty panels in the first row of facet_grid

I was trying to use facet_grid to lay out panels, for example, library(tidyverse) library(lubridate) economics %>% filter(date >= ymd(19680101)) %>% mutate( year = year(date), month = month(date), decade = floor(year/10) * 10, …
Chuliang Xiao
  • 300
  • 2
  • 8
6
votes
3 answers

Edit distance between the facet / strip and the plot

For example, library(ggplot2) ggplot(mpg, aes(displ, cty)) + geom_point() + facet_grid(cols = vars(drv)) How can I change the distance between the strip and the main plot? (For example, create a gap between the strip and the main plot.) But I…
Feng Tian
  • 1,559
  • 1
  • 18
  • 27
6
votes
1 answer

Seaborn FacetGrid PointPlot Label Data Points

Given the following: import seaborn as sns attend = sns.load_dataset("attention") sns.set_style("whitegrid", {'axes.grid' : False,'axes.edgecolor':'none'}) g = sns.FacetGrid(attend, col="subject", col_wrap=5, size=1.5, ylim=(0, 10)) ax =…
Dance Party2
  • 7,214
  • 17
  • 59
  • 106
6
votes
0 answers

R ggplot2 facet_grid "hierarchical" formatting with 3 variables or more

I'm trying to get a nice display when having multiple variables on one dimension of my facet_grid so that instead of repeating the name of all variables for each column (or row) I have a merged box over sub-boxes. Taking a concrete example with a…
Arthur Spoon
  • 442
  • 5
  • 18
6
votes
2 answers

how to wrap text in ggplot for facet_grid labels

I have been searching how to wrap text. It seems there should be a way to use labeller = label_wrap_gen(3) but I keep getting an error: --- Error in margins(vars, margins) : unused argument (margins) Here is part of my code: #simpson by protected…
6
votes
2 answers

ggplot2: Deleting facets of unused factor level combinations from a plot (facet_grid)

I would like to selectively delete unnecessary facets from a facetted ggplot2 figure. I had a look at this question but could not figure out how to do it (maybe the advise there is outdated now): adding empty graphs to facet_wrap in ggplot2 Here is…
NoBackingDown
  • 2,144
  • 1
  • 19
  • 25
6
votes
2 answers

ggplot: Generate facet grid plot with multiple series

I have following data frame: Quarter x y p q 1 2001 8.714392 8.714621 3.3648435 3.3140090 2 2002 8.671171 8.671064 0.9282508 0.9034387 3 2003 8.688478 8.697413 6.2295996 8.4379698 4 2004 8.685339 8.686349…
add-semi-colons
  • 18,094
  • 55
  • 145
  • 232
5
votes
0 answers

Unique y-axis in facet_grid in each single panel (rows AND columns)

I am struggling to give each single pannel in facet_grid its own y-axis. So basically I want all subplots of this plot to have it's own y-axis (so that you can actually see the data). At the same time, I want a fixed x-axis per column as it is…
Svenno Nito
  • 635
  • 1
  • 6
  • 22
5
votes
1 answer

Passing argument to facet grid in function -ggplot

I am trying to write a function to plot graphs in a grid. I am using ggplot and facet grid. I am unable to pass the argument for facet grid. I wonder if anybody can point me in the right direction. The data example: Year = as.factor(rep(c("01",…
5
votes
2 answers

python facetgrid with sns.barplot and map; target no overlapping group bars

I am currently implementing a code for facetgrid with subplots of barplots with two different groups ('type'), respectively. I am intending to get a plot, where the different groups are not stacked and not overlapping. I am using following code g =…
Rockbar
  • 1,081
  • 1
  • 20
  • 31
1 2
3
42 43