Questions tagged [facet-wrap]

In R graphics system ggplot2, facet_wrap is a way to wrap a 1d ribbon of panels into 2d shape. Typically, it groups a data set by one or more categorical variables or variables coercible to factor and plots one data group per panel using the same aesthetics mappings.

In R graphics system ggplot2, facet_wrap is a way to wrap a 1d ribbon of panels into 2d shape. Typically, it groups a data set by one or more categorical variables or variables coercible to factor and plots one data group per panel using the same aesthetics mappings.

Resources for using facet_wrap:

873 questions
0
votes
1 answer

Q: facet_wrap scales per tile

i have two type of parameters and one response for one chemical compound: The code used to generated this picture was for (i in levels(data$ProteinName)) { temp <- subset(data, data$ProteinName == i) plot <-…
0
votes
1 answer

GGplot multiple pages prints same first plots over and over

I'm trying to make a pdf of multiple plots, but the pdf only ever prints the first n amount of plots. I'm using ggforce::facet_wrap_paginate. Below is the code I've written. I'd love if anyone had any advice for why I'm only getting the first 6…
0
votes
1 answer

Wrong grouping with facet_wrap and geom_bar

I have a dataset that looks like: Pair,Total readNUM,Uniquely mapped…
fra
  • 832
  • 6
  • 14
0
votes
3 answers

Improper facet_wrap output

The below is my sample data Though there are values for mobile and tablet across all 4 dates, when I try to facet_wrap across device category, my results are not what is expected. All the values corresponding to each date are being added to the…
0
votes
1 answer

ggplot: arrange cluttered character labels of a factor variable

How to remove the cluttered x-axis labels and arrange them in the desired order? # Data generation dataPlot <- data.frame(iVal = sample(paste('i', 1:22, sep=''), 300, replace=TRUE), facetVal = sample(LETTERS[1:3], 300,…
Prradep
  • 5,506
  • 5
  • 43
  • 84
0
votes
3 answers

Arranging factors in increasing order

I am trying to create two plots which should display frequency in a decreasing order. #preparing the data to resemble actual data test <- data.frame(HairEyeColor) %>% mutate(combi = paste(Hair,Eye)) %>% group_by(Sex) %>% mutate(prop = Freq /…
0
votes
0 answers

Attempting to add mean line to facet_wrap plot with additional grouping variable

I'm attempting to make a scatterplot with ggplot. My data set is made up for 4 columns, three of which are factor variables and the fourth is a continuous variable. 'data.frame': 108 obs. of 4 variables: $ Name : Factor w/ 3 levels…
0
votes
0 answers

how to fix sizes of figures in facet_wrap() or multiplot() in r

I want to plot multiple figures with several panels. The data structure I have, quality organism component group value se Rho(-) Phytoplankton C16.1 MUFA 0.022336602 0.001715501 Rho(-) Phytoplankton C16.2n4 PUFA 0 …
Jellz
  • 435
  • 1
  • 7
  • 14
0
votes
1 answer

How to connect observations containing NAs using ggplot for facetting?

Just aiming to use connect observations containing NAs using ggplot and the facet option df <- data.frame( time = 1:5, y1 = c(4, 2, 3, 1, NA), y2 = c(4, 5, NA, 6, 10), y3 = c(8, 7, NA, 4, 5) ) library(ggplot2) ggplot(df,…
dambach
  • 79
  • 7
0
votes
1 answer

Non absolute counts histogram for imbalanced groups

Currently, I can create the plot: by using: df %>% ggplot(aes_string(age)) + facet_wrap(~CUSTOMER_GROUP, scales="free") + geom_histogram(binwidth = 3) + scale_y_continuous(labels=percent) + theme_igray() + xlab("Age") + ylab("") But…
Georg Heiler
  • 16,916
  • 36
  • 162
  • 292
0
votes
0 answers

Lack of basic understanding of facet_wrap in ggplot2

I have a (probably) easy problem with histograms in ggplot2 when using facet_wrap with this sample-table res<-data.frame(c('a1','a1','a1','a1','a2','a2'),c('b1','b1','b2','b3','b1','b2'),c(1.0,1.5,2.5,4.0,1.0,2.5)) colnames(res)<-c("A","B","C") I…
0
votes
1 answer

facet_wrap get count of column

There's a little problem that I'm not able to solve. In my dataset I have three columns (pluginUserID, type, timestamp) and I want to create a ggplot with facet wrap for every pluginUserID. My dataset looks like this, just with more…
Aldu
  • 1
  • 1
0
votes
1 answer

How to extract single plots from facet_plot and maintain scaling?

From one dataframe of data in long format, the first plot call below gives me this matrix of joyplots: There is one ridgeline and color scale across each of the 13 scenarios. However, when I try to show just one plot per page, in the looped…
dbo
  • 1,174
  • 1
  • 11
  • 19
0
votes
1 answer

ggplot2 facet_wrap doesn't find a variable but shape does

I'm running in a bit of a problem plotting some data with ggplot2: I want to use a facet_wrap over a variable AdultInputProp, but R doesn't find the variable and instead returns an Error in as.quoted(facets) : object 'AdultInputProp' not found. Now…
Arthur Spoon
  • 442
  • 5
  • 18
0
votes
2 answers

Mismatched linetypes in plot and legend

I plot this data using the following code df = read.csv(file = "data.csv"); p = ggplot(data = df) + geom_line(aes(x=x,y=yp,linetype="dashed")) + geom_line(aes(x=x,y=yi,linetype="solid")) + facet_wrap(~s) + labs(y="y"); I am getting the following…
Dariusz
  • 1
  • 1