search for: last_plot

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

Did you mean: last_pkt
2010 Dec 06
2
ggplot2: Controlling line width of panel borders
...aes(fill=year,y=yield,x=variety)) p2 <- p1 + geom_bar(position="dodge",stat="identity") dodge <- position_dodge(width=0.9) p3 <- p2 + geom_errorbar(limits,position=dodge,width=0.5,size=0.7) p4 <- p3 + facet_wrap(~site,ncol=2) p5 <- p4+theme_bw(base_size=16) p5 last_plot() + opts(panel.grid.minor=theme_blank()) # deletes the minor grid lines ## Now i would like to increase the width of all remaining lines (bottom, left, top, right border of all panels and stripes) in the plot, as a certain minimum lines width is required by many journals last_plot() + opts(p...
2012 Feb 16
2
Problem building up ggplot graph in a loop.
Folks, I want to automate some graphing using ggplot. Here is my code graphChargeOffs2<-function(coffs) { ggplot(coffs, aes(levels)) dataNames<-names(coffs)[!names(coffs) == "levels"] for(i in dataNames) { thisData<-coffs[[i]] last_plot() + geom_line(aes(y = thisData, colour = i)) } last_plot() + ylab("Total Chargeoffs") } coffs is a data.frame. I get the following error: Error in eval(expr, envir, enclos) : object 'thisData' not found As little as I know about environments in R I am pretty sure that the g...
2009 Mar 31
4
what is the preferred method to create a package local variable?
for the moment, I'm using: .onAttach <- function(libname, pkgname) { .bbg.db.conn <<- dbConnect(dbDriver("PostgreSQL"), user="blah","blah") } .onUnload <- function(libpath) { dbDisconnect(.bbg.db.conn) } which results in a hidden global variable in the global environment. I would prefer to make the assignment only in the package namespace.
2010 Jun 10
1
Order labels in qplot() - ggplot2 {help}
Hello, I want to arrage the label according to my preference eg.. (va, vp, a, b, c) but don't know how to supress default ordering. Any suggestions? Please try the code below: n <- c("va", "vp", "a", "b", "c") p <- c(2, 2,1, 3,5) pm<- c(3,4,2,5,4) pn <- c(1,1,1,2,3) x<-data.frame(cbind(n,p,pm,pn)) library(ggplot2) qplot(x=n,
2010 Apr 24
2
left-to-right series of box and whisker plots from a csv file
Hi, I've got a csv file with scores like this: 40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,32,38,40,20,40,26,40,30,40,5,5,13,12,40,40,3,33,29,23,2,24,9,15,4,21,16,5,26,8,8,18 40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,32,40,40,30,40,40,37,34,40,36,13,40,13,40,5,40,8,29,5,15,34,5,22,14,20
2010 Mar 10
1
ggplot2: Changing colour scheme for bar plot filling?
Hello, I'd like to sitch to a monochrome/bw color-palette for the filling of geom_bar-bars (produced via "qplot" as in the example below). Hours of googling didn't yield anything useful, so I thought, I'd just ask ... Thanks, Joh library(ggplot2) qplot(factor(cyl), data=mtcars, geom="bar", fill=factor(cyl))
2009 Jun 08
1
Looking for easy way to normalize data by groups
Hi, i do have a dataframe representing data from a repeated experiment. PID is a subject identifier, Time are timepoints in an experiment which was repeated twice. For each subject and all three timepoints there are 2 sets of four values. df <- data.frame(PID = c(rep("A", 12), rep("B", 12), rep("C", 12)), Time = rep(c(0, 0, 0, 0, 30, 30, 30,
2007 Sep 03
1
Legend issue with ggplot2
Dear useRs, I'm struggling with the new version of ggplot2. In the previous version I did something like this. But now this yield an error (object "fill" not found). library(ggplot2) dummy <- data.frame(x = rep(1:10, 4), group = gl(4, 10)) dummy$y <- dummy$x * rnorm(4)[dummy$group] + 5 * rnorm(4)[dummy$group] dummy$min <- dummy$y - 5 dummy$max <- dummy$y + 5 ggplot(data
2010 Sep 10
3
ggplot bar geom: control the filling in the colour legend
Hi all, Is it possible to change the filling of the squares used to represent the colour legend in a bar plot with ggplot? in this example, fillings are raven black, I'd like them white. ggplot(diamonds, aes(clarity, colour = cut)) + geom_bar() Regards -- ------------- Benoit Boulinguiez Ph.D student Ecole de Chimie de Rennes (ENSCR) Bureau 1.20 Equipe CIP UMR CNRS 6226 "Sciences
2013 Mar 28
2
ggplot2: less than equal sign
Hi I am trying to add a less than equal sign to a plot. I have previously done this using unicode but is not working in this instance. Any suggestions would be great thanks example code: library(ggplot2) df<-data.frame(vis=c(0,0,1,1) , count=c(10,15,20,10) , grp=c(0,1,0,1)) df$grp <-factor(df$grp ,levels=c(0,1) , labels =c("x \u2265 10" , "x > 10")) ggplot(df,
2011 Aug 31
2
ggplot2 to create a "square" plot
Dear all, I am using ggplot with geom_tile to print as an image a matrix  I have. My matrix is a squared one of 512*512 cells.  The code that does that is written below > print(v + geom_tile(aes(fill=dB))+ opts(axis.text.x=theme_text(size=20),axis.text.y=theme_text(size=20), axis.title.x=theme_text(size=25) , axis.title.y=theme_text(size=25), legend.title=theme_text(size=25,hjust=-0.4) ,
2008 Jan 17
2
Converting plots to ggplot2
Hello Hadley, I am trying to reproduce the following with ggplot: a <- seq(0, 360, 5)*pi/180 ; a ac <- sin(a + (45*pi/180)) + 1 ; ac plot(a, ac, type='b', xaxt = "n") axis(1, at=seq(0,6,1), labels=round(seq(0,6,1)*180/pi),1) abline(v=c(45*pi/180, 225*pi/180)) I can get the basic plot: p <- qplot(a, ac, geom=c('point', 'line')) ;
2010 Jan 18
2
ggplot2 histogramm
Hi, i get no success change the title of the "fill" (colour) legend and the defintion of "levels". Have anybody a hint how i can do this. df <- data.frame(variable=sample(c("A","B","C"),1000,replace=T,prob=c(0.22,0.28,0.5)),group=gl(2,500)) p <- ggplot(df, aes(x = variable)) p + geom_histogram(aes(y= ..count.. /
2009 Oct 06
1
ggplot2: mapping categorical variable to color aesthetic with faceting
Hello Again... I?m making a faceted plot of a response 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 +
2010 Oct 17
2
dpois().......bizarre warning messages
Dear Masters, I have a question to submit consider the following script m<-4.95 obs<-rpois(36,m) # i generate 36 realization from a poisson(m) hist(obs,freq=F) curve(dpois(x,m),add=T,col="red") #i wish to overlay on the histogram the theorical poisson density function errors are returned saing the x vector doesn't contain integers.... really bizarre i can't give
2010 Aug 24
0
mlm for within subject design
...ur got into the # legend. This is because we *mapped* the same aesthetic (color) in the second # geom_line() call to the one existing for IDs. ggplot2 is smart enough to pick # this up. [We just have to be smart enough to realize it :)]. To exert more # control over line colors, add the following: last_plot() + scale_colour_manual(values = c('1' = 'red', '2' = 'green', '3' = 'blue', 'mean' = 'black')) The LHS is the value of ID, the RHS the color to associate with it. As usual, it took me about five itera...