similar to: Adding lines in ggplot2

Displaying 20 results from an estimated 20000 matches similar to: "Adding lines in ggplot2"

2011 Feb 11
1
Time Series in R with ggplot2
Hi Folks, First, the important information. > sessionInfo() R version 2.12.1 (2010-12-16) Platform: i386-pc-mingw32/i386 (32-bit) Second, my problem. I have a series of data sets comprised in the following format. > totsoc Location Year Value 1 SOUTH 1998 29 2 SOUTH 1999 20 3 SOUTH 2000 32 4 SOUTH 2001 29 5 SOUTH 2002 25 6 SOUTH 2003 28 7
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))
2009 Sep 09
2
ggplot2: mixing colour and linetype in geom_line
Hi all, I try to represent a multiple curve graphic where the x-axis is the temperature and the different y-axes are the different X (X22,X43,X44...) some X corresponds to the same molecule (22 and 44 are for CO2 for instance) so I use the same colour for them. I wanna mix the linetype with the colour to be able to visually see the difference between X43 and X45 The best I have done up to now
2009 Feb 18
1
lineplot in ggplot2 with different colour and linetype
Hi list, I would like to use ggplot2 in creating a line plot with 4 lines (groups), 2 of which I want in colour and the remaining two as dotted lines. ### R code ### library(ggplot2) ### create data #### vals <- rnorm(400) div<- c(rep("A",100),rep("B",100),rep("C",100),rep("D",100)) n<- rep(1:100,4) df<- data.frame(div=
2011 Jan 03
7
Saving objects inside a list
Hello there, any ideas on how to save all the objects on my workspace inside a list object? For example, say my workspace is as follows ls() [1] "x" "y" "z" and suppose I want to put these objects inside a list object, say object.list <- list() without having to explicitly write down their names as in object.list$x = x object.list$y = y object.list$z = z Is
2010 Mar 24
1
GGPLOT2: Reverse order of legend to match order of x-axis
How do I reverse the order of the legend in a bar plot to match order of the x-axis? In other words, I want the stacked colors of the legend to match the stacked colors of the bar plot. I tried this, but it didn't work. colors <- c("5" = "red","4" = "blue","3" = "darkgreen") p <- qplot(factor(cyl), data=mtcars,
2008 Sep 24
1
qplot, stacked area, own colourscheme
Dear list, I would like to apply my own colours to a stacked area plot, done with qplot, but I have not succeeded... What do I have so far (I am dealing with the development of cover of specific groups of plants): library(ggplot2) library(RODBC) channel <- odbcConnect("myusername", case="tolower") sql <- "select trial, cover_of, dateofsurvey, cover from
2011 Nov 28
1
plotting multiple lines on single graph ggplot2
Hello everyone I have some data of the following type. 100 200 300 400 500 1.1 1.2 1.3 1.4 1.5 600 700 800 900 1000 1.5 1.7 1.9 2.0 2.4 With plot() and points functions I can plot these 4 lines of data. But I dont know how to do it with qplot or ggplot functions. The scenario is something like this: the hundreds should appear on x-axis and the fractional values of y axis. Thanks alot. MEMON
2012 Oct 08
1
weighted cumulative distribution with ggplot2
Dear all, I am trying to draw a weighted cumulative distribution (as defined here http://rss.acs.unt.edu/Rdoc/library/spatstat/html/ewcdf.html) with ggplot2 however the syntax temp<-qplot(X,weight=weight,data=data,stat = "ecdf", geom = "step",colour=factor(year)) seems not to produce exactly the right figure (the values seems higher at some points)... I am wrong in the
2010 Nov 17
2
Numerical integration
Hi! I was wondering if there are any other functions for numerical integration, besides 'integrate' from the stats package, but which wouldn't require the integrand to be vectorized. Oh, and must be capable of integrating over (-inf,+inf). Thanks in advance, Eduardo Horta [[alternative HTML version deleted]]
2008 Sep 17
1
ggplot2 - deprecated guide= argument in
In the help for scale_fill_identity, it is written ## Not run: colour <- c("red","green","blue","yellow") qplot(1:4, 1:4, fill=colour, geom="tile") qplot(1:4, 1:4, fill=colour, geom="tile") + scale_fill_identity() # To get a legend, you also need to supply the labels to # be used
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:
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
2011 Dec 07
2
plotting and coloring longitudinal data with three time points (ggplot2)
Dear list, I have been struggling with this for some time now, and for the last hour I have been struggling to make a working example for the list. I hope someone out there have some experience with plotting longitudinal data that they will share. My data is some patient data with three different time stamps. First the patients are identified at different times (first time stamp). Second, they
2009 Feb 26
1
ggplot2: labels points with different colors or idnumbers
Dear list,   Using ggplot2 I could produce both boxplot and points in the same plot but instead of points I would like to label the different subjects with different colors or their idnumbers. Is there away to do it? Also how can I put three plots on the same graph with ggplot2? mfrow=c(3,1) did not do the job.   > dat    group time   id  freq 1      1   00 0018  5.21 2      1   00 3026  3.13
2011 Jun 21
2
qplot/ggplot2 Questions
I took some data from an online poll about which R GUI people used most and I am messing around with it to learn how to use qplot. Specifically I am making a horizontal bar graph and I have two questions. 1. The categories are ordered in rather strange way at least to me. It is not alphabetical or ascending/descending order of votes cast so i had to manually state the order I wanted which is
2009 Mar 02
3
ways to put multiple graphs on single page (using ggplot2)
Hi, Here are three plots: library(ggplot2) data(diamonds) randind <- sample(nrow(diamonds),1000,replace=FALSE) dsmall <- diamonds[randind,] qplot(carat, data=dsmall, geom="histogram",binwidth=1) qplot(carat, data=dsmall, geom="histogram",binwidth=.1) qplot(carat, data=dsmall, geom="histogram",binwidth=.01) What are ways to put these three plots on a single
2011 Jan 14
2
bug in qplot (library ggplot2)
Hello, this following code give a nice png: /library(ggplot2) i <- 1 png(file=paste('test ',i,'.png',sep='')) qplot(carat, data=diamonds, fill=color,geom='histogram')+scale_y_continuous(i) dev.off() / I would like to get more files, but the following code doesn't make any file: /library(ggplot2) for (i in 1:2) { png(file=paste('test
2012 Jan 16
2
ggplot2 stacked bar - sum of values rather than count
Hi, I'm trying to create a stacked bar plot using ggplot2. Rather than plotting the count of each of the 13 "Bar" factors on the Y axis, I would like to represent the sum of the Values associated with each of the 13 "Bar" factors. Is there a way to do that? Given the following data, that would obviously mean that there would be some negative sums represented. Here's
2011 Aug 04
1
Plotting just a portion of a smoother graph in ggplot2
Hi, I am using ggplot2 to with the following code: gmathk2 <- qplot(time,math,colour=Kids,data=kids.ach.lm.k5,geom="smooth",method="lm",formula=y~ns(x,1)) + opts(title="Smoother Plot: Math K-5") + xlab("Time") + ylab("Math") + scale_colour_brewer(pal="Set1"); gmathk2 This plots all the smoother for all the x values. What I'd like