similar to: using facet_grid() from ggplot2 with additional text in labels

Displaying 20 results from an estimated 5000 matches similar to: "using facet_grid() from ggplot2 with additional text in labels"

2009 Oct 02
1
ggplot2: proper use of facet_grid inside a function
Hello Again R Folk: I have found items about this in the archives, but I?m still not getting it right. I want to use ggplot2 with facet_grid inside a function with user specified variables, for instance: p <- ggplot(data, aes_string(x = fac1, y = res)) + facet_grid(. ~ fac2) Where data, fac1, fac2 and res are arguments to the function. I have tried p <- ggplot(data,
2010 Nov 09
1
ggplot2: facet_grid with different vertical lines on each facet
Hello, I am plotting many histograms together using facet_grid in ggplot2. However, I want to then add a vertical line to each histogram, or facet, each of which vertical lines are at different x-values. The following example adds all vertical lines to each facet: ggplot(data,aes(values)) + geom_histogram() + facet_grid(.~variable) + geom_vline(xintercept=c(5,10,15)) How can I add a vertical
2011 Jan 18
2
ggplot2, geom_hline and facet_grid
Hi I have a long data set on which I want to do Bland-Altman style plots for each rhythm type Using ggplot2, when I use geom_hline with facet_grid I get an extra set of empty panels. I can't get it to do it with the "Diamonds" data supplied with the package so here is a (much abbreviated) example: > lvexs cvd_basestudy ecd_rhythm fixed_time variable_time 1 CBP05J02
2010 Oct 28
1
ggplot2: facet_grid with only one level does not display the graph with the facet_grid level in title
Hi All, Here is the code that I'll be referring to: p <- ggplot(wastran.data, aes(PER_KEY, EVENTS)) (p <- p + facet_grid( pool.short ~ .) + stat_summary(aes(y=EVENTS), fun.y = sum, geom="line") + opts(axis.text.x = theme_text(angle = 90, hjust=1), title="Events (15min.) vs. Time: Facet pool", strip.text.y = theme_text()) ) Now, depending on preceding
2008 Nov 22
2
ggplot2 - facet_grid and facet_wrap
Hello R users (and Hadley) I have another question about ggplot2 :-) (version 0.8) `dat` <- structure(list(D = c("a", "b", "c", "d"), G = c(1.51520888871520, 1.88812208268440, -6.60521862, 0.55968739), E = c(1.38888592256404, 1.39366168665589, 1.22509259382058, 1.36617701059296), I = c(6.92634958902857, 6.94416045215158, 13.2179488828556,
2013 Sep 18
1
ggplot2: changing strip text in facet_grid and a legend text problem
Hi, Dummy data script and scripts are attached below. I would like to change the plot to look like this:
2016 Apr 20
2
overlay two facet_grid
Hi all, Does anyone know how to overlay two facet_grids? I have two facet grids as following: ggplot(data=df,aes(x=TE,y=TR,color="orange"))+geom_point()+facet_grid(FS+TRJ~OR+INV,labeller=label_both)+xlim(0,200)+ylim(0,10000) ggplot(data=df,aes(x=TE,y=TR))+geom_point(aes(color=TST))+facet_grid(FS+TRJ~OR+INV,labeller=label_both)+xlim(0,200)+ylim(0,10000) Thanks for any help! Elahe
2013 Nov 12
0
geom_abline does not seem to respect groups in facet_grid [ggplot2]
Just trying to understand how geom_abline works with facets in ggplot. By way of example, I have a dataset of student test scores. These are in a data table dt with 4 columns: student: unique student ID cohort: grouping factor for students (A, B, . H) subject: subject of the test (English, Math, Science) score: the test score for that student in that subject The goal is to compare
2016 Apr 20
0
overlay two facet_grid
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example Overlaying aesthetics is possible. Overlaying graphs is not. Without sample data, concrete examples will be unlikely to appear, so read the above link and pay attention to the dput function. -- Sent from my phone. Please excuse my brevity. On April 20, 2016 3:01:43 PM PDT, "ch.elahe via R-help"
2008 Jan 27
1
Putting frame around single panels in ggplot 2 and facet_grid()
Hi I want to highlight two panels in a grid created with facet_grid() by putting a box around it or usiong another background colour. Is this possible, and if yes, how? Thanks Rainer -- Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation Biology (UCT) Plant Conservation Unit Department of Botany University of Cape Town Rondebosch 7701 South Africa Tel: +27 - (0)21 650 5776 (w) Fax:
2011 Dec 23
1
simple ggplot2 question
Hello, I am trying to make a plot using the code below. The plot is divided into two parts, using facet_grid. I would like the vertical axis (labelled 'place') to be different for each location (=part). So in the upper part, only places 'n' through 'z' are shown, while in the lower part, only places 'a' through 'm' are shown. I thought 'free_y'
2008 Mar 25
2
ggplot2 - facetting
Dear All, After having overcome the issue of legends (thanks, Thierry, once more), I am trying to use facetting, but here also I can not find how to do this. I do not want to use qplot, but rather the more flexible options. However, it seems I am doing still something pretty stupid, because I always get an error, even if it seems I am doing everything like the examples. My code is below.
2013 Mar 06
6
Ggplot2: Moving legend, change fill and removal of space between plots when using grid.arrange() possible use of facet_grid?
Hi, # For publications, I am not allowed to repeat the axes. I have tried to remove the axes using: # yaxt="n", but it did not work. I have not understood how to do this in ggplot2. Can you help me? # I also do not want loads of space between the graphs (see below script with Dummy Data). # If I could make it look like the examples on the (nice) examples page: #
2011 Jul 09
1
Suppressing the labelling of tick marks on ggplot2
Hi, I have the follow ggplot2 code I am running: ggplot(data=bb.res.math,aes(x=factor(id.bb),y=bb.math.comb,fill=BB)) + geom_bar() + facet_grid(BB~.) + scale_fill_brewer(pal="Set1") + ylab("Average Student Residual (Math)") + xlab("Student ID") The number of unique id.bb is 2207 and so my X-axis has a couple of thousands, indistinguishable tick marks that correspond
2012 Mar 12
1
Faceted bar plot shows wrong counts (ggplot2)
I have encountered a problem with faceted bar plots. I have tried to create something like the example explained in the ggplot2 book (see pp. 126-128): library(ggplot2) mpg4 <- subset(mpg, manufacturer %in% c("audi", "volkswagen", "jeep")) mpg4$manufacturer <- as.character(mpg4$manufacturer) mpg4$model <- as.character(mpg4$model) base <-
2008 Nov 17
1
ggplot2: can one have separate ylim for each facet?
In lattice #toy data library(ggplot2) library(lattice) x <- rnorm(100) y <- rnorm(100) k <- sample(c("Weak","Strong"),100,replace=T) j <- sample(c("Tall","Short"),100,replace=T) w <- data.frame(x,y,j,k) xyplot(y~x|j+k,scales=list(y=list(relation="free"))) will give you a scale in each subplot with a range equal to the range of y
2010 Sep 11
1
Setting scales for ggplot2 with facets
Faceting in ggplot2 seems to permit different scales for different facets, but I fail to see how one could control ylim and xlim ranges for each facet separately. For instance, I would like to set the ylim = c(0,10) for facet "A" and ylim = c(42,102) for facet "B". Since the data is out of these ranges, setting facet_grid(factor ~ ., scales = "free_y") does not
2011 May 18
1
Changing order of facet grid in ggplot2
Hi I am running the following code: sym <- c(sym1,sym2,sym4) lifedxm <- c("O-BD","O-WELL","O-UNI") life <- c(lifedxm,lifedxm,lifedxm) tp <- c("TP-ANY","TP-ANY", "TP-ANY", "TP-SUB", "TP-SUB", "TP-SUB", "TP-CLIN" , "TP-CLIN", "TP-CLIN") data <-
2015 Mar 02
2
R-devel does not update the C++ returned variables
Hi, Within my R code, I am using a C++ function as below: overlaps <- matrix(0, nrow=B, ncol=length(N)) overlaps.P <- matrix(0, nrow=B, ncol=length(N)) .C("speedUp", D, S, pD, pS, nrow(D), as.integer(N), length(N), ssq[i], i, as.integer(B), overlaps, overlaps.P, DUP=FALSE) the function "speedUp", is supposed to update matrices overlaps
2008 Jan 24
1
Calculating sum of squares from density estimates
Hi I have some density estimates obtained from density(). I would like to calculate the sum of squares of these. As the x values of the estimates are not the same, and I would prefer not to restrict the estiomate to a certain range of x values, how can I do the calculation? Lets say: d1 <- density(Data1) d2 <- density(Data2) If the x values would be the same, I would: ssq <- sum(