similar to: ggplot2 facets as rows and columns

Displaying 20 results from an estimated 1300 matches similar to: "ggplot2 facets as rows and columns"

2011 Jun 07
1
ggplot2 Histogram with density curve
I am learning ggplot2 commands and I have figured out how to create histograms and density curves but I am not sure how to add a density curve on top of a histogram. Here are the two graphs that I created. ## Histogram t<-rnorm(500) w<-qplot(t, main="Normal Random Sample", fill=I("blue"), colour=I("black"), geom="histogram") w ##Density Curve
2012 Aug 06
4
Overlay Histogram
Dear all, For two sets of random variables, say, x <- rnorm(1000, 10, 10) and y <- rnorm(1000. 3, 20). Is there any way to overlay the histograms (and density curves) of x and y on the plot of y vs. x? The histogram of x is on the x axis and that of y is on the y axis. The density curve here is to approximate the shape of the distribution and does not have to have area 1. Thank you
2009 Aug 19
2
ggplot2 legend problem
I'm trying to overlay two histograms using transparency to enable viewing of multiple distributions on a single scale. So far ggplot2 seems to do what I want. However I'm having a problem generating the legend coloring appropriate to each distribution in the plot. Here is a test case to show my best (failed) effort so far: library(ggplot2) x <- data.frame(X=rnorm(1000, mean=0)) y
2018 Apr 16
0
Fwd: Help with R-Calling forth csv.
Hi, I do not know how to post in general again, however my csv contains around 5-250k data Points depending on vehicle/road type and pressure exerted on geotechnical structures. I have used R to develope histograms of said csv files and will attach such Picture to you in this mail and the csv used. Below I will type the R code I have used for this histogram.
2008 Jan 24
4
two histograms in the same graph
Dear Contributors: I have two vectors x and z, and I want to display the histograms of both vectors in the same graph, x in red bars, z in blue bars. If you have any clue on how to do that, I will be very glad to hear it!!!!!! Thanks in advance again, Juan Pablo Fededa [[alternative HTML version deleted]]
2008 Oct 02
2
Multiple hist(ograms) - One plot
Hello, I am trying to plot multiple histograms with the same scales, etc into one plot. The commands below produce a 3 page PDF with each histogram occupying the upper right quadrant. And use slightly different scales on the X and Y axes. > s21 <- dat[dat$sc_recov=="21",] > s21.ED <- subset(s21, select=(bbED)) > s31 <- all[all$sc_recov=="31",] > s31.ED
2008 Jan 15
4
Overlay plots from different data sets using the Lattice package
#After spending the entire day working on this question, I have decided to reach out for support: #I am trying to overlay a densityplot from one data set over a histogram of another, if I were to plot the two individually, they would look like: # data frame construction data.frame.A <- data.frame(rnorm(12*8), c(rep("one", 4), rep("two", 4), rep("three", 4)),
2009 Nov 30
5
Histogram and Density on the the same graph
Dear all, I cannot find a function which would allow drawing hist and density on the same graph. x <- seq(1,40,1) y <- 2*x+1+5*rnorm(length(x)) hist(y,freq = FALSE) plot(density(y)) thanks a lot for the help [[alternative HTML version deleted]]
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 Oct 05
2
subplot strange behavoir
Hello, Below is some example code that should reproduce an error I'm encountering while trying to create a tiff plot with two subplots. If I run just the following bit of code through the R GUI the result is what I'd like to have appear in the saved tiff image: x<-seq(0:20) y<-c(1,1,2,2,3,4,5,4,3,6,7,1,1,2,2,3,4,5,4,3,6) plot(x,y,type="l",las=1,ylim=c(0,12))
2005 Jul 13
1
unexpected par('pin') behaviour
hi everybody, I noticed the following: in one of my scripts 'layout' is used to generate a (approx. square) grid of variable dimensions (depending on no. of input files). if the no. of subplots (grid cells) becomes moderately large (say > 9) I use a construct like ###layout grid computation and set up occurs here### ... opar <- par(no.readonly = T);
2009 Aug 28
1
problem plotting with ggplot2
Dear R-Help subsribers, upon running into a wonderful ggplot2 package by accident, I abruptly encountered another problem. Almost every command run with ggplot2 results in some sort of error. The one below is far the most common one. Kind people from ggplot2 mailing list couldn't manage to solve the problem, so I'm re-posting it here to try my luck. I will recommend myself for any tips
2010 Sep 16
1
Help with graphic margin
Hi everyone. I would like to make a graphic with 2 subplots (lets say A and B). For instance, I use : par(mfcol = c(2,1)); The 2 subplots use the same X axis. So I provide no tics labels and no xlab for the top plot. I would like the second plot to be right bellow the first one (small margin). So my question is how I can keep a small gap between the 2 plots while having enough space under
2009 Mar 25
2
[ggplot2] Densityplot, grouping and NAs
Dear all, I do not fully understand how ggplot2 handles NAs. See the following example: library(ggplot2) x <- rnorm(150) g <- as.factor(c(rep(c(0,1,NA),50))) mydf <- data.frame(x,g) m <- ggplot(aes(x = x, group = g, color = g), data = mydf) m + geom_density() How do I get rid of the NAs (i.e. the blue colored curve)? I thought ## m <- ggplot(aes(x = x, group = g, color = g,
2010 May 10
1
ggplot: Trouble with xlim() and discrete scales
I'm learning ggplot and am a little confused. Sometimes discrete scales work like I'd expect, and sometimes they don't. For example... This works exactly like one would expect: df<-data.frame(names=c("Bob","Mary","Joe","Bob","Bob")) ggplot(df,aes(names))+geom_histogram() But this yields an error:
2008 May 15
2
mixed effects models with nested factors
Hi everybody, I am trying to fit a model with the lmer function for mixed effects. I have an experimental design consisting of 5 field plots. Each plot is divided in 12 subplots where the influence of three factors on the growing of tree seedlings is tested: (1) seed (1 = presence; 0 = absence); (2) seedling species (oak holm vs. pine); (3) treatment (three different treatments). In each of
2008 Mar 04
1
ggplot2 - Problem with grid plot
Hi R-help I'm trying to create a grid plot in which each plot in the grid contains two density plots (colored by factor) and two vertical lines at the respective medians (also colored by the factor). Using the diamonds dataset as an example, the following commands give me price density plots by factor cut in a single, ungridded plot. p <- ggplot(data=diamonds, aes(x=price)) +
2011 Jul 06
2
how to best present concentrated data points/ ggplot2
Hi all, I am trying to plot a weighted density plot for two different types and want to show the data points on the x axis. The code is as follows. The data points are very concentrated. Is there a better way to present it( should I set the alpha value or something else)? Thanks! YL library(ggplot2) x <- rnorm(10000) a <- rnorm(5000) b <- rnorm(5000) weights.x <- abs(a/sum(a))
2009 Aug 19
3
ggplot 2 semi-transparency error
Hi, I used the command ggplot as follows... p<-ggplot(a,aes(x=a$V1,colour=a$V2,fill=a$V2)) p + geom_density(alpha = 0.2,xlim=c(-10,10),ylim=c(0,0.5)) when I say, dev.print(device=postscript,file="/alpha/dct.pdf") I get Warning message: In grid.Call.graphics("L_polygon", x$x, x$y, list(as.integer(1L:length(x$x)))) : semi-transparency is not supported on this device:
2008 Mar 20
4
little subplot in corner
I want to draw a little subplot ("overview") into my detailed plot. It should be placed in say the top right corner and have the size of some legend (like legend(x="topright", inset=0.03, ...) #main plot plot(rnorm(100)) #give little density in corner plot(seq(-2,2,length=300),dnorm(seq(-2,2,length=300)),type="l") I don't want something like par(mfrow=c(1,2)) as