search for: position_jitter

Displaying 16 results from an estimated 16 matches for "position_jitter".

2009 Sep 12
1
ggplot2: deterministic position_jitter & geom_line with position_jitter
Dear guRus, I am starting to work with the ggplot2 package and have two very dumb questions: 1) deterministic position_jitter - the jittering is stochastic; is there any way to get a deterministic jittering? For instance: example.data <- data.frame(group=c("foo","bar","foo","bar","foo","bar"),x=c(1,1,2,2,3,3),y=c(1,1,0,2,1,1)) set.seed(2009) qplot(x,y,data=...
2013 Mar 08
2
ggplot2: modifying line width and background fill color for stat_smooth()
...-alpha transparent version of the same color used for the separate fitted lines for GENDER, rather than grey for both. How can I do this? donner<-read.csv("http://www.ling.upenn.edu/~joseff/data/donner.csv") ggplot(donner, aes(AGE, NFATE, color = GENDER))+ geom_point(position = position_jitter(height = 0.02, width = 0)) + stat_smooth(method = "glm", family = binomial, formula = y ~ poly(x,2)) For the line width, I tried, ggplot(donner, aes(AGE, NFATE, color = GENDER))+ geom_point(position = position_jitter(height = 0.02, width = 0)) + stat_smooth(aes(size=2), method...
2017 Nov 02
3
ggplot inside function doesn't plot
I have a function: myplot <- function (X) { d <- plotCounts(dds2, gene=X, intgroup="condition", returnData=TRUE) png(paste("img/", X, ".png", sep="")) ggplot(d, aes(x=condition, y=count, color=condition)) + geom_point(position=position_jitter(w=0.1,h=0)) + scale_y_log10(breaks=c(25,100,400)) + ggtitle(X) + theme(plot.title = element_text(hjust = 0.5)) dev.off() } 'd' is a dataframe count condition E11.5 F20HET BA40_quant 955.9788 E11.5 F20HET E11.5 F20HET B...
2017 Nov 02
3
ggplot inside function doesn't plot
...<- function (X) { >> d <- plotCounts(dds2, gene=X, intgroup="condition", returnData=TRUE) >> png(paste("img/", X, ".png", sep="")) >> ggplot(d, aes(x=condition, y=count, color=condition)) + >> geom_point(position=position_jitter(w=0.1,h=0)) + >> scale_y_log10(breaks=c(25,100,400)) + >> ggtitle(X) + >> theme(plot.title = element_text(hjust = 0.5)) >> >> dev.off() >> } >> >> 'd' is a dataframe >> >> coun...
2008 Nov 19
2
ggplot2; dot plot, jitter, and error bars
...a <- data.frame(x,xlab,y,lwr,upr) I would like to make a dot plot and use lwr and upr as error bars. Above 0=Low. I would like there to be some space between the 5 and the 6 corresponding to Low so I tried jittering: p <- ggplot(mydata, aes(x=x, y=y)) p+geom_point() p + geom_jitter(position=position_jitter(xjitter=2)) But I obtained this error: Error in get("new", env = PositionJitter, inherits = TRUE)(PositionJitter, : unused argument(s) (xjitter = 2) Any suggestions on how to plot this. I could create the separation in the x-axis (0,0.2,1,1.2,2,2.2). If so, how could I relable the a...
2017 Nov 02
0
ggplot inside function doesn't plot
...gt; > myplot <- function (X) { > d <- plotCounts(dds2, gene=X, intgroup="condition", returnData=TRUE) > png(paste("img/", X, ".png", sep="")) > ggplot(d, aes(x=condition, y=count, color=condition)) + > geom_point(position=position_jitter(w=0.1,h=0)) + > scale_y_log10(breaks=c(25,100,400)) + > ggtitle(X) + > theme(plot.title = element_text(hjust = 0.5)) > > dev.off() > } > > 'd' is a dataframe > > count condition > E11.5 F20HET BA...
2010 May 31
0
Put two plots side by side
Two different ways: library(ggplot2) x=5 size=50 A=data.frame(X=sample(x, size, replace=T), Y=sample(x, size, replace=T),a=rep(1:2,each=25));A # Facetting qplot(X,Y,data=A) + geom_jitter(position=position_jitter(width=.03)) + facet_grid(.~a) # Or with vp p=qplot(X, Y, data=A) + geom_jitter(position=position_jitter(width=.03)) ggsave(p, file='main.png') p1=qplot(X, Y, data=A) + geom_jitter(position=position_jitter(width=.3)) ggsave(p1, file='main2.png') vport <- function(x, y) viewport(la...
2009 Oct 06
1
ggplot2: mapping categorical variable to color aesthetic with faceting
...esponse on two categorical variables using ggplot2 and having troubles with the coloring. Here is a sample that produces the desired plot: compareCats <- function(data, res, fac1, fac2, colors) { require(ggplot2) p <- ggplot(data, aes(fac1, res)) + facet_grid(. ~ fac2) jit <- position_jitter(width = 0.1) p <- p + layer(geom = "jitter", position = jit, color = colors) print(p) } test <- data.frame(res = rnorm(100), fac1 = as.factor(rep(c("A", "B"), 50)), fac2 = as.factor(rep(c("lrg", "lrg", "sm", "sm...
2008 Oct 05
0
ggplot2 - version 0.7
...segment: should now work correctly in all coordinate systems (note that arrows only work in Cartesian coordinates) * ggsave: correctly uses dpi for raster devices and default dpi changed to 72 (thanks to Brian Ripley for pointing this out) * ggsave: current device no longer closes if error occurs * position_jitter: now works correctly with 0 jitter * remove_missing: some statistics were calculated incorrectly when missing values were present * scales: extra scales ignored (again) * scales: legends respect fixed parameters of the layer * scales: legends won't appear when aesthetics are mapped to NULL, or...
2008 Oct 05
0
ggplot2 - version 0.7
...segment: should now work correctly in all coordinate systems (note that arrows only work in Cartesian coordinates) * ggsave: correctly uses dpi for raster devices and default dpi changed to 72 (thanks to Brian Ripley for pointing this out) * ggsave: current device no longer closes if error occurs * position_jitter: now works correctly with 0 jitter * remove_missing: some statistics were calculated incorrectly when missing values were present * scales: extra scales ignored (again) * scales: legends respect fixed parameters of the layer * scales: legends won't appear when aesthetics are mapped to NULL, or...
2011 Jan 25
2
ggplot geom_boxplot and stat_smooth
...n", "vlakan"), class = "factor")), .Names = c("konc.f", "bel", "typ"), row.names = c(NA, -102L), class = "data.frame") > Here is what I did p<-ggplot(ad, aes(x=konc.f, y=bel, colour=typ)) p+geom_boxplot()+geom_jitter(position=position_jitter(w=0.1))+stat_smooth() geom_smooth: Only one unique x value each group.Maybe you want aes(group = 1)? I get nice picture with boxes but I expected to get something like smoothing line through box centres. Is it possible without some hack to stat_smooth code? Regards Petr
2013 Dec 17
1
ggplot2: stat_smooth for family=binomial with cbind(Y, N) formula
With ggplot2, I can plot the glm stat_smooth for binomial data when the response is binary or a two-level factor as follows: data("Donner", package="vcdExtra") ggplot(Donner, aes(age, survived)) + geom_point(position = position_jitter(height = 0.02, width = 0)) + stat_smooth(method = "glm", family = binomial, formula = y ~ x, alpha = 0.2, size=2) But how can I specify the formula for stat_smooth when the response is cbind(successes, failures)? The equivalent with plot (minus the confidence band) for the example I wa...
2013 Jan 14
1
Tukey HSD plot with lines indicating (non-)significance
...dered by group means, and it is only guaranteed to # work for balanced data. Example, with the lines missing: library(ggplot2) d=rice d$trt=reorder(d$trt, -d$ShootDryMass) ggplot(d, aes(x=trt, y=ShootDryMass)) + geom_boxplot(outlier.colour=NA) + geom_jitter(col="red", size=3, position=position_jitter(width=.1)) Is there such a function available in R? -- Karl Ove Hufthammer
2011 Oct 21
1
lattice::xyplot/ggplot2: plotting weighted data frames with lmline and smooth
In the HistData package, I have a data frame, PearsonLee, containing observations on heights of parent and child, in weighted form: library(HistData) > str(PearsonLee) 'data.frame': 746 obs. of 6 variables: $ child : num 59.5 59.5 59.5 60.5 60.5 61.5 61.5 61.5 61.5 61.5 ... $ parent : num 62.5 63.5 64.5 62.5 66.5 59.5 60.5 62.5 63.5 64.5 ... $ frequency: num 0.5 0.5
2011 Jun 03
2
Y error bars, dates on the X-axis
Dear forum, Does anyone know any functions for plotting vertical error bars, if the x-axis variable is a date? I can produce a pretty plot with dates on the x-axis, if I don't want to include error bars. I can also produce a nice plot with error bars, if I just use Julian days for the x-axis, but I'd much rather have the actual dates. I have tried writing my own function, plotCI
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))