similar to: ggplot2: can one have separate ylim for each facet?

Displaying 20 results from an estimated 6000 matches similar to: "ggplot2: can one have separate ylim for each facet?"

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'
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
2013 Apr 14
1
Problem plotting continuous and discrete series in ggplot with facet
I have data that plots over time with four different variables. I would like to combine them in one plot using facet_grid, where each variable gets its own sub-plot. The following code resembles my data require(ggplot2) require(reshape2) subm <- melt(economics, id='date', c('psavert','uempmed','unemploy')) mcsm <- melt(data.frame(date=economics$date,
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 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 <-
2009 Oct 06
1
ggplot2 applying a function based on facet
Look at the bottom of the message for my question #here is a little function that I wrote USGS <- function(input="discharge", days=7){ library(chron) library(gsubfn) #021973269 is the Waynesboro Gauge on the Savannah River Proper (SRS) #02102908 is the Flat Creek Gauge (ftbrfcms) #02133500 is the Drowning Creek (ftbrbmcm) #02341800 is the Upatoi Creek Near Columbus (ftbn) #02342500 is
2010 May 09
1
Is it possible to rearrange the facets in ggplot while keeping everything else the same?
Hello, First, ggplot2 is great! Second, sorry for the basic nature of my question. I have data in the form of a melt table like this: Subject Day Ab Variable Value 1 1 Yes A 3 1 3 Yes A 5 1 5 Yes A 7 2 1 No A 2 2 3 No A 4 2 5 No A 6 3 1 Yes A 1 3 3 Yes A 3 3 5 Yes A 5 4 1 No A 4 4 3 No A 6 4 5 No A 8 1 1 Yes B 3 1 3 Yes B 5 1 5 Yes B 7 2 1 No B 2 2 3 No B 4 2 5 No B 6 3 1 Yes B 1 3 3 Yes B 3 3 5
2007 Nov 08
1
ggplot2 facets as rows and columns
Does anyone (Hadley??) know if there's a straightforward way in ggplot2 to get data divided by a single factor to plot as a rectangular grid of subplots? So far I've only been able to get such data plotted as a single row or single column of skinny subplots. The code below gives an example implemented with lattice, and my best attempt in ggplot2 cheers Ben Bolker ------------ g=
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.
2009 Feb 11
2
Label bars in a faceted bar plot in ggplot2
Hi List, I am running R 2.8.0 on a Windows XP machine, running ggplot2 version 0.8.1 I want to label the bars in a faceted grid barplot. Reproducible R code is given below: #### reproducible facet barplot ##### library(ggplot2) # Dataset from which to create the barplot ml <- rep(1:10,2) vals <- rnorm(20,mean = 10, sd=1) type <- c(rep("MAPE",10),rep("AIC",10))
2009 Jul 24
1
ggplot question
In page http://had.co.nz/ggplot2/scale_date.html , there is a time series plot for multiple variables at the bottom. i.e qplot(date, value, data = em, geom = "line", group = variable) + + facet_grid(variable ~ ., scale = "free_y") How can I make different color for different series? Thanks -- View this message in context:
2008 May 12
1
Converting qqplot2 qplot() to grammar?
Hello all, I've been using the following qplot command: qplot(pixX,pixY, data=som, geom="tile", fill=rgb) + scale_fill_identity() + opts(aspect.ratio = .75) + facet_grid(unitX ~ unitY) Now I would like to convert it into the explicit ggplot grammar, so I can remove the extras: axes, labels, background, borders, facet labels, and extra white-space around the plot. (If anyone has
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 <-
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
2011 Jun 11
0
problems with geom_vline, histograms, scale=free and facets in ggplot
Dear list, I?m having a little trouble with adding vertical lines to a histogram. I need to draw a matrix of histograms (using facets), and in each histogram add a vertical line indicating the mean value of the data in each facet. According to the last example in the geom_hline help, to display different lines in each facet I need to provide a data frame. I modified this example to make a plot
2011 Feb 10
1
Ggplot: free x-scales in a facet-grid
Hello, I have a ggplot that has the looks of the plot that I want, but it doesn't have the right layout. The data is an ordered melted dataframe: - ID - type (to use for a faced grid) - time - type - time - value (POSIXct) - pos (to use for a faced grid, this is an index to split the plot) The goal of the plot is to create a time line for each ID (different points of time). The ID's
2010 Aug 11
2
help to polish plot in ggplot2
Hi, I wanted to generate a plot which is almost like the plot generated by the following codes. category <- paste("Geographical Category", 1:10) grp1 <- rnorm(10, mean=10, sd=10) grp2 <- rnorm(10, mean=20, sd=10) grp3 <- rnorm(10, mean=15, sd=10) grp4 <- rnorm(10, mean=12, sd=10) mydat <- data.frame(category,grp1,grp2,grp3,grp4) dat.m <- melt(mydat) p <-
2007 Jul 16
2
Different axis limits for each facet in ggplot2
Hi! Is it possible to have different axis limit for each facet in a ggplot2 plot? Here is an example: -------------------------------------------------------------- library(ggplot2) x=seq(-10,10,.1) y=cos(x) z=sin(x)*10 dat=melt(data.frame(x,y,z), id.var="x") qplot( x, value, data=dat, facets=variable~., geom="line" )
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,
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