plot graph with error bars trouble

classic Classic list List threaded Threaded
20 messages Options
Reply | Threaded
Open this post in threaded view
|

plot graph with error bars trouble

Marcelo Luiz de Laia
Hi,

I have a data set like this:

Mutant    Rep    Time   OD
02H02    1    0    0.029
02H02    2    0    0.029
02H02    3    0    0.023
02H02    1    8    0.655
02H02    2    8    0.615
02H02    3    8    0.557
02H02    1    12    1.776
02H02    2    12     1.859
02H02    3    12    1.668
02H02    1    16    3.379
02H02    2    16    3.726
02H02    3    16    3.367
306    1    0    0.033
306    2    0    0.035
306    3    0    0.034
306    1    8     0.377
306    2    8    0.488
306    3    8    0.409
306    1    12    1.106
306    2    12    1.348
306    3    12    1.246
306    1    16    2.706
306    2    16    3.073
306    3    16    3.038

I need to plot a graph OD over the time for each one mutant with error bars.

I try the package sciplot, but this package is set up to handle
factorial treatments, so the spacing in x-axis is fixed to be equal.
Than, with it I got something like this:

|
|
|
|
|
+-----------------------------
0        8          12          16

But, I would like spacing between 0 and 8 2-fold the spacign between 8
and 12, like this:

|
|
|
|
|
+--------------------------------------
0        4          8          12          16

Could you point me out another way to do this with out using sciplot?
Any suggestion is very appreciated.

In advance, I doesn't have a good knowledge about R language.

Thank you very much

--
Marcelo Luiz de Laia

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: plot graph with error bars trouble

Ben Bolker
Marcelo Laia <marcelolaia <at> gmail.com> writes:

>
> Hi,
>
> I have a data set like this:
>

 [snip]

> I need to plot a graph OD over the time for each one mutant with error bars.
>
>


## I put your data in a temporary file, this reads it
x = read.table("tempdata.txt",header=TRUE)


## compute means and standard errors
##  (no built-in function for standard error, so create one)
## also see ?aggregate, ?by
means =  with(x,tapply(OD,list(Time,Mutant),mean))
se = function(x) sd(x)/sqrt(length(x))
ses = with(x,tapply(OD,list(Time,Mutant),se))

## time vector -- could also be unique(x$Time)
times = as.numeric(rownames(means))

## plot the means
matplot(times,means,type="b",lty=1,col=1:2,pch=1:2)
library(plotrix)
## have to create the x-vector and color-vector "by hand"
##  it would be nice if there were a matplotCI, but there
## isn't (yet) ...
plotCI(rep(times,2),means,ses,pch=NA,add=TRUE,
          col=rep(1:2,each=nrow(means)))

  good luck
   Ben Bolker

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: plot graph with error bars trouble

hadley wickham
On 9/30/07, Ben Bolker <[hidden email]> wrote:

> Marcelo Laia <marcelolaia <at> gmail.com> writes:
>
> >
> > Hi,
> >
> > I have a data set like this:
> >
>
>  [snip]
>
> > I need to plot a graph OD over the time for each one mutant with error bars.
> >
> >
>
>
> ## I put your data in a temporary file, this reads it
> x = read.table("tempdata.txt",header=TRUE)
>
>
> ## compute means and standard errors
> ##  (no built-in function for standard error, so create one)
> ## also see ?aggregate, ?by
> means =  with(x,tapply(OD,list(Time,Mutant),mean))
> se = function(x) sd(x)/sqrt(length(x))
> ses = with(x,tapply(OD,list(Time,Mutant),se))
>
> ## time vector -- could also be unique(x$Time)
> times = as.numeric(rownames(means))
>
> ## plot the means
> matplot(times,means,type="b",lty=1,col=1:2,pch=1:2)
> library(plotrix)
> ## have to create the x-vector and color-vector "by hand"
> ##  it would be nice if there were a matplotCI, but there
> ## isn't (yet) ...
> plotCI(rep(times,2),means,ses,pch=NA,add=TRUE,
>           col=rep(1:2,each=nrow(means)))

I'd do this a little differently, using the reshape
(http://had.co.nz/reshape) and ggplot2 (http://had.co.nz/ggplot2)
packages:

library(reshape)
library(ggplot2)

# Get data in format required for reshape
df <- rename(df, c("OD" = "value"))

# Summarise and compute errors
se <- function(x) sd(x)/sqrt(length(x))
means <- cast(df, Mutant + Time ~ ., c(mean, se))

qplot(Time, mean, data=means, colour=Mutant, min = mean - se, max =
mean + se, geom=c("point","errorbar"))

# or maybe

qplot(Time, mean, data=means, colour=Mutant, min = mean - se, max =
mean + se, geom=c("line","errorbar"))

# or even

qplot(Time, mean, data=means, fill=Mutant, min = mean - se, max = mean
+ se, geom=c("ribbon", "line"))

Depending on the purpose of the error bars, you will want to adjust
their length.

Hadley

--
http://had.co.nz/

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: plot graph with error bars trouble

Ben Bolker-2
hadley wickham wrote:

> I'd do this a little differently, using the reshape
> (http://had.co.nz/reshape) and ggplot2 (http://had.co.nz/ggplot2)
> packages:
>
> library(reshape)
> library(ggplot2)
>
> # Get data in format required for reshape
> df <- rename(df, c("OD" = "value"))
>
> # Summarise and compute errors
> se <- function(x) sd(x)/sqrt(length(x))
> means <- cast(df, Mutant + Time ~ ., c(mean, se))
>
> qplot(Time, mean, data=means, colour=Mutant, min = mean - se, max =
> mean + se, geom=c("point","errorbar"))
>
>  

  I can certainly see the value of a more elegant/automated/higher-level
solution
(although knowing the base-graphics way of going about it can be helpful
too).

   However, at least the first plot you suggest looks a little bit funny
to me.
Suppose that the x coordinates of the error
bar are x_L (left edge of bars), x_0 (middle of bars/location
of data point), and x_R (right edge of bars), and the y coordinates
are y_B, y_0, and y_U (bottom [min], middle, and top [max]).
The "errorbar" specification seems to add a series of
segments from (x_L,y_B) of one point to
(x_L,y_U) of the next  [sorry if this is confusing, but I'm trying
to describe a picture ...]

(1) this seems like a funny default (I wouldn't normally want this line
drawn if I specified "errorbars"), (2) even if one has the line,
 the x-positions of the segment endpoints still seem wrong (or at least
a wrong default) -- I still
think they should line up with the x-coordinates of the data

  Poking around http://had.co.nz/ggplot2/geom_errorbar.html hasn't
resolved this (yet).

  I thought that breaking it down a bit might help, but it appears to do
the same thing ...

p = ggplot(means, aes(x=Time, y=mean,
colour=Mutant,min=mean-se,max=mean+se))
p + geom_errorbar()

  Can you see what I mean, or am I confused/have an old version/etc. ?

  cheers
    Ben

 > sessionInfo()
R version 2.5.1 (2007-06-27)
i386-pc-mingw32

locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
States.1252;LC_MONETARY=English_United
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252

attached base packages:
[1] "splines"   "grid"      "stats"     "graphics"  "grDevices"
"utils"     "datasets"  "methods"   "base"    

other attached packages:
     ggplot2   colorspace RColorBrewer         MASS        proto      
reshape
     "0.5.5"       "0.95"      "1.0-1"     "7.2-36"      "0.3-8"      
"0.8.0"

 

PS if one specifies "errorbars" without specifying min and max one gets
the error

Error in rbind(max, max, max, min, min, min) :
        cannot coerce type closure to list vector

  perhaps a more transparent error message could be supplied in this
(admittedly
stupid-user-error-obvious-in-hindsight) case?

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: plot graph with error bars trouble

hadley wickham
> hadley wickham wrote:
> > I'd do this a little differently, using the reshape
> > (http://had.co.nz/reshape) and ggplot2 (http://had.co.nz/ggplot2)
> > packages:
> >
> > library(reshape)
> > library(ggplot2)
> >
> > # Get data in format required for reshape
> > df <- rename(df, c("OD" = "value"))
> >
> > # Summarise and compute errors
> > se <- function(x) sd(x)/sqrt(length(x))
> > means <- cast(df, Mutant + Time ~ ., c(mean, se))
> >
> > qplot(Time, mean, data=means, colour=Mutant, min = mean - se, max =
> > mean + se, geom=c("point","errorbar"))
> >
> >
>
>   I can certainly see the value of a more elegant/automated/higher-level
> solution
> (although knowing the base-graphics way of going about it can be helpful
> too).
>
>    However, at least the first plot you suggest looks a little bit funny
> to me.
> Suppose that the x coordinates of the error
> bar are x_L (left edge of bars), x_0 (middle of bars/location
> of data point), and x_R (right edge of bars), and the y coordinates
> are y_B, y_0, and y_U (bottom [min], middle, and top [max]).
> The "errorbar" specification seems to add a series of
> segments from (x_L,y_B) of one point to
> (x_L,y_U) of the next  [sorry if this is confusing, but I'm trying
> to describe a picture ...]
>
> (1) this seems like a funny default (I wouldn't normally want this line
> drawn if I specified "errorbars"), (2) even if one has the line,
>  the x-positions of the segment endpoints still seem wrong (or at least
> a wrong default) -- I still
> think they should line up with the x-coordinates of the data
>
>   Poking around http://had.co.nz/ggplot2/geom_errorbar.html hasn't
> resolved this (yet).
>
>   I thought that breaking it down a bit might help, but it appears to do
> the same thing ...
>
> p = ggplot(means, aes(x=Time, y=mean,
> colour=Mutant,min=mean-se,max=mean+se))
> p + geom_errorbar()
>
>   Can you see what I mean, or am I confused/have an old version/etc. ?
>

Oooooh - oops.  I completely forgot about that error - it's fixed in
the current development version of ggplot which I should probably
think about uploading to CRAN.

> PS if one specifies "errorbars" without specifying min and max one gets
> the error
>
> Error in rbind(max, max, max, min, min, min) :
>         cannot coerce type closure to list vector
>
>   perhaps a more transparent error message could be supplied in this
> (admittedly
> stupid-user-error-obvious-in-hindsight) case?

Yes, that's a good idea.  I'm still working on making the error
messages more user friendly.  I think I'm making some progress, but
it's fairly slow.

Hadley


--
http://had.co.nz/

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: plot graph with error bars trouble

jiho
On 2007-September-30  , at 22:40 , hadley wickham wrote:

>> hadley wickham wrote:
>>> [...]
>> PS if one specifies "errorbars" without specifying min and max one  
>> gets
>> the error
>>
>> Error in rbind(max, max, max, min, min, min) :
>>         cannot coerce type closure to list vector
>>
>>   perhaps a more transparent error message could be supplied in this
>> (admittedly
>> stupid-user-error-obvious-in-hindsight) case?
>
> Yes, that's a good idea.  I'm still working on making the error
> messages more user friendly.  I think I'm making some progress, but
> it's fairly slow.

BTW, have you thought about opening ggplot2 development (provide a  
way to check out the dev code and have the possibility to submit  
patches at least) or do you prefer to keep it a personal project for  
now? I don't know how intricate your research and the development of  
ggplot2 are and would understand that you want to keep in 100% hadley  
wickham if you are to be judged on it academically. But boring work  
such as improving error messages, writing documentation and chasing  
small bugs is probably more efficiently done by a team than by a  
single person, with little free time. Furthermore, most of these  
things can be done without deep knowledge of the architecture of  
ggplot2.
I probably won' t be able to make significant contributions before a  
while but I would be happy to see how ggplot2 progresses and which  
directions are taken by following an SVN tree.

JiHO
---
http://jo.irisson.free.fr/

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: plot graph with error bars trouble

hadley wickham
On 9/30/07, jiho <[hidden email]> wrote:

> On 2007-September-30  , at 22:40 , hadley wickham wrote:
> >> hadley wickham wrote:
> >>> [...]
> >> PS if one specifies "errorbars" without specifying min and max one
> >> gets
> >> the error
> >>
> >> Error in rbind(max, max, max, min, min, min) :
> >>         cannot coerce type closure to list vector
> >>
> >>   perhaps a more transparent error message could be supplied in this
> >> (admittedly
> >> stupid-user-error-obvious-in-hindsight) case?
> >
> > Yes, that's a good idea.  I'm still working on making the error
> > messages more user friendly.  I think I'm making some progress, but
> > it's fairly slow.
>
> BTW, have you thought about opening ggplot2 development (provide a
> way to check out the dev code and have the possibility to submit
> patches at least) or do you prefer to keep it a personal project for
> now? I don't know how intricate your research and the development of
> ggplot2 are and would understand that you want to keep in 100% hadley
> wickham if you are to be judged on it academically. But boring work
> such as improving error messages, writing documentation and chasing
> small bugs is probably more efficiently done by a team than by a
> single person, with little free time. Furthermore, most of these
> things can be done without deep knowledge of the architecture of
> ggplot2.

It's something I have thought a little bit about, but I haven't made
much progress. Ideally, if it's something that I do for ggplot2, I
should do it for all my other R packages too.  I have thought about
setting up google code projects for each package, which would also
provide a nice set of bugtracking tools.  I've cc'd Gabor on this
email in the hope that he might describe his experiences with this
approach.

> I probably won' t be able to make significant contributions before a
> while but I would be happy to see how ggplot2 progresses and which
> directions are taken by following an SVN tree.

The one thing that google code currently lacks is a nice timeline +
browser interface.  I find this very useful for GGobi
(http://src.ggobi.org) and would like to maintain that functionality
somehow.  It also makes it easier to track progress of the code
through rss, or intermittent reading of the trac site.

There is also the psychological barrier of giving up complete
ownership of the code, and accepting that people will write code that
is different to the way I'd write it.

Hadley

--
http://had.co.nz/

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: plot graph with error bars trouble

Gabor Grothendieck
On 9/30/07, hadley wickham <[hidden email]> wrote:

> On 9/30/07, jiho <[hidden email]> wrote:
> > On 2007-September-30  , at 22:40 , hadley wickham wrote:
> > >> hadley wickham wrote:
> > >>> [...]
> > >> PS if one specifies "errorbars" without specifying min and max one
> > >> gets
> > >> the error
> > >>
> > >> Error in rbind(max, max, max, min, min, min) :
> > >>         cannot coerce type closure to list vector
> > >>
> > >>   perhaps a more transparent error message could be supplied in this
> > >> (admittedly
> > >> stupid-user-error-obvious-in-hindsight) case?
> > >
> > > Yes, that's a good idea.  I'm still working on making the error
> > > messages more user friendly.  I think I'm making some progress, but
> > > it's fairly slow.
> >
> > BTW, have you thought about opening ggplot2 development (provide a
> > way to check out the dev code and have the possibility to submit
> > patches at least) or do you prefer to keep it a personal project for
> > now? I don't know how intricate your research and the development of
> > ggplot2 are and would understand that you want to keep in 100% hadley
> > wickham if you are to be judged on it academically. But boring work
> > such as improving error messages, writing documentation and chasing
> > small bugs is probably more efficiently done by a team than by a
> > single person, with little free time. Furthermore, most of these
> > things can be done without deep knowledge of the architecture of
> > ggplot2.
>
> It's something I have thought a little bit about, but I haven't made
> much progress. Ideally, if it's something that I do for ggplot2, I
> should do it for all my other R packages too.  I have thought about
> setting up google code projects for each package, which would also
> provide a nice set of bugtracking tools.  I've cc'd Gabor on this
> email in the hope that he might describe his experiences with this
> approach.
>
> > I probably won' t be able to make significant contributions before a
> > while but I would be happy to see how ggplot2 progresses and which
> > directions are taken by following an SVN tree.
>
> The one thing that google code currently lacks is a nice timeline +
> browser interface.  I find this very useful for GGobi
> (http://src.ggobi.org) and would like to maintain that functionality
> somehow.  It also makes it easier to track progress of the code
> through rss, or intermittent reading of the trac site.
>
> There is also the psychological barrier of giving up complete
> ownership of the code, and accepting that people will write code that
> is different to the way I'd write it.
>

If you already know svn then google code is very easy to use.  Setting
yourself up on it is really just a few minutes of work in that case.  I have
used other similar sites but google code is by far the easiest one to
work with of the ones I have tried. By default everyone has read access
and only you have write access so you still control the project.  You can
browse through the R projects that are already in google code here:
http://code.google.com/hosting/search?q=label:R

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: plot graph with error bars trouble

Jim Lemon
In reply to this post by Marcelo Luiz de Laia
Marcelo Laia wrote:

> Hi,
>
> I have a data set like this:
>
> Mutant    Rep    Time   OD
> 02H02    1    0    0.029
> 02H02    2    0    0.029
> 02H02    3    0    0.023
> 02H02    1    8    0.655
> 02H02    2    8    0.615
> 02H02    3    8    0.557
> 02H02    1    12    1.776
> 02H02    2    12     1.859
> 02H02    3    12    1.668
> 02H02    1    16    3.379
> 02H02    2    16    3.726
> 02H02    3    16    3.367
> 306    1    0    0.033
> 306    2    0    0.035
> 306    3    0    0.034
> 306    1    8     0.377
> 306    2    8    0.488
> 306    3    8    0.409
> 306    1    12    1.106
> 306    2    12    1.348
> 306    3    12    1.246
> 306    1    16    2.706
> 306    2    16    3.073
> 306    3    16    3.038
>
> I need to plot a graph OD over the time for each one mutant with error bars.
>
> I try the package sciplot, but this package is set up to handle
> factorial treatments, so the spacing in x-axis is fixed to be equal.
> Than, with it I got something like this:
>
> |
> |
> |
> |
> |
> +-----------------------------
> 0        8          12          16
>
> But, I would like spacing between 0 and 8 2-fold the spacign between 8
> and 12, like this:
>
> |
> |
> |
> |
> |
> +--------------------------------------
> 0        4          8          12          16
>
> Could you point me out another way to do this with out using sciplot?
> Any suggestion is very appreciated.
>
Hi Marcelo,
This might be a task for brkdn.plot in the plotrix package except for
the X positions. I have written a revision of the function as this will
be a useful enhancement and minimally tested it, so if you would like to
give it a try, here it is:

library(plotrix)
# here is the revised function, may have some line breaks
brkdn.plot<-function(vars,groups=NA,obs=NA,data,
  mct="mean",md="std.error",
  stagger=NA,dispbar=TRUE,
  main="Breakdown plot",xlab=NA,ylab=NA,xaxlab=NA,
  ylim=NA,type="b",pch=1,lty=1,col=par("fg"),...) {

  if(is.na(obs)) {
   if(is.na(groups))
    stop("Must have at least one factor to subset data")
   bygroup<-as.factor(data[[groups]])
   grouplevels<-levels(bygroup)
   ngroups<-length(grouplevels)
   nobs<-length(vars)
   obslevels<-1:nobs
  }
  else {
   byobs<-as.factor(data[[obs]])
   obslevels<-levels(byobs)
   nobs<-length(obslevels)
   if(is.numeric(unlist(data[obs])))
    obs.pos<-unique(unlist(data[obs]))
   else obs.pos<-1:nobs
   if(is.na(groups)) {
    ngroups<-length(vars)
    grouplevels<-1:ngroups
   }
   else {
    bygroup<-as.factor(data[[groups]])
    grouplevels<-levels(bygroup)
    ngroups<-length(grouplevels)
    if(length(vars) > 1) {
     warning("Group and observation present, only vars[1] plotted")
     vars<-vars[1]
    }
   }
  }
  brkdn<-list(matrix(NA,nrow=ngroups,ncol=nobs),
   matrix(NA,nrow=ngroups,ncol=nobs))
  if(is.na(groups)) {
   if(is.na(xlab)) xlab<-"Observation"
   xat<-1:nobs
   if(is.na(xaxlab[1])) xaxlab<-obslevels
   for(group in 1:ngroups) {
    for(ob in 1:nobs) {
     brkdn[[1]][group,ob]<-
      do.call(mct,list(unlist(subset(data[[vars[group]]],
       data[[obs]] == obslevels[ob],vars[group])),na.rm=TRUE))
     if(!is.na(md))
      brkdn[[2]][group,ob]<-
       do.call(md,list(unlist(subset(data[[vars[group]]],
        data[[obs]] == obslevels[ob],vars[group])),na.rm=TRUE))
    }
   }
  }
  else {
   if(is.na(obs)) {
    if(is.na(xlab)) xlab<-"Variable"
    xat<-1:length(vars)
    if(is.na(xaxlab[1])) xaxlab<-vars
    for(group in 1:ngroups) {
     for(ob in 1:nobs) {
      brkdn[[1]][group,ob]<-
       do.call(mct,list(unlist(subset(data[[vars[ob]]],
        data[[groups]] == grouplevels[group],vars[ob])),na.rm=TRUE))
      if(!is.na(md))
       brkdn[[2]][group,ob]<-
        do.call(md,list(unlist(subset(data[[vars[ob]]],
         data[[groups]] == grouplevels[group],vars[ob])),na.rm=TRUE))
     }
    }
   }
   else {
    if(is.na(xlab)) xlab<-"Observation"
    xat<-obs.pos
    if(is.na(xaxlab[1])) xaxlab<-obslevels
    for(group in 1:ngroups) {
     for(ob in 1:nobs) {
      brkdn[[1]][group,ob]<-
       do.call(mct,list(unlist(subset(data,data[[groups]] ==
grouplevels[group] &
        data[[obs]] == obslevels[ob],vars)),na.rm=TRUE))
      if(!is.na(md))
       brkdn[[2]][group,ob]<-
        do.call(md,list(unlist(subset(data,data[[groups]] ==
grouplevels[group] &
         data[[obs]] == obslevels[ob],vars)),na.rm=TRUE))
     }
    }
   }
  }
  if(is.na(ylim[1])) {
   if(is.na(md)) ylim<-range(brkdn[[1]])
   else
    ylim<-c(min(brkdn[[1]]-brkdn[[2]],na.rm=TRUE),
     max(brkdn[[1]]+brkdn[[2]],na.rm=TRUE))
  }
  groupdiv<-ifelse(ngroups < 3,1,ngroups-2)
  if(is.na(stagger)) stagger<-0.025-groupdiv*0.0025
  if(is.na(ylab)) {
   if(length(vars) == 1) ylab<-vars[1]
   else ylab<-paste(vars,collapse=" and ")
  }
  plot(0,xlim=c(obs.pos[1]-0.5,obs.pos[nobs]+0.5),
   main=main,xlab=xlab,ylab=ylab,ylim=ylim,
   type="n",axes=FALSE,...)
  box()
  axis(1,at=xat,labels=xaxlab)
  axis(2)
  if(length(pch) < ngroups) pch<-rep(pch,length.out=ngroups)
  if(length(col) < ngroups) col<-rep(col,length.out=ngroups)
  if(length(lty) < ngroups) lty<-rep(lty,length.out=ngroups)
  offinc<-stagger*diff(par("usr")[c(1,2)])
  offset<-0
  arrow.cap<-0.01-(groupdiv*0.001)
  for(group in 1:ngroups) {
   points(obs.pos+offset,brkdn[[1]][group,],type=type,
    col=col[group],pch=pch[group],lty=lty[group])
   if(dispbar)
    dispbars(obs.pos+offset,brkdn[[1]][group,],brkdn[[2]][group,],
     arrow.cap=arrow.cap,col=col[group])
   offset<-ifelse(offset<0,-offset,-offset-offinc)
  }
  names(brkdn)<-c(mct,md)
  return(brkdn)
}
# read in the data
ml.df<-read.csv("../ml.csv")
# call the new function
brkdn.plot("OD","Mutant","Time",ml.df,col=c(2,3))

Jim

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: plot graph with error bars trouble

Martin Maechler
In reply to this post by Gabor Grothendieck

>>>>> "GaGr" == Gabor Grothendieck <[hidden email]>
>>>>>     on Sun, 30 Sep 2007 21:15:37 -0400 writes:

    GaGr> On 9/30/07, hadley wickham <[hidden email]> wrote:
    >> On 9/30/07, jiho <[hidden email]> wrote:
    >> > On 2007-September-30  , at 22:40 , hadley wickham wrote:
    >> > >> hadley wickham wrote:
    >> > >>> [...]
    >> > >> PS if one specifies "errorbars" without specifying min and max one
    >> > >> gets
    >> > >> the error
    >> > >>
    >> > >> Error in rbind(max, max, max, min, min, min) :
    >> > >>         cannot coerce type closure to list vector
    >> > >>
    >> > >>   perhaps a more transparent error message could be supplied in this
    >> > >> (admittedly
    >> > >> stupid-user-error-obvious-in-hindsight) case?
    >> > >
    >> > > Yes, that's a good idea.  I'm still working on making the error
    >> > > messages more user friendly.  I think I'm making some progress, but
    >> > > it's fairly slow.
    >> >
    >> > BTW, have you thought about opening ggplot2 development (provide a
    >> > way to check out the dev code and have the possibility to submit
    >> > patches at least) or do you prefer to keep it a personal project for
    >> > now? I don't know how intricate your research and the development of
    >> > ggplot2 are and would understand that you want to keep in 100% hadley
    >> > wickham if you are to be judged on it academically. But boring work
    >> > such as improving error messages, writing documentation and chasing
    >> > small bugs is probably more efficiently done by a team than by a
    >> > single person, with little free time. Furthermore, most of these
    >> > things can be done without deep knowledge of the architecture of
    >> > ggplot2.
    >>
    >> It's something I have thought a little bit about, but I haven't made
    >> much progress. Ideally, if it's something that I do for ggplot2, I
    >> should do it for all my other R packages too.  

I don't see why doing it for *some* package(s) should entail
doing it for all of them

    >> should do it for all my other R packages too.  I have thought about
    >> setting up google code projects for each package, which would also
    >> provide a nice set of bugtracking tools.  I've cc'd Gabor on this
    >> email in the hope that he might describe his experiences with this
    >> approach.
    >>
    >> > I probably won' t be able to make significant contributions before a
    >> > while but I would be happy to see how ggplot2 progresses and which
    >> > directions are taken by following an SVN tree.
    >>
    >> The one thing that google code currently lacks is a nice timeline +
    >> browser interface.  I find this very useful for GGobi
    >> (http://src.ggobi.org) and would like to maintain that functionality
    >> somehow.  It also makes it easier to track progress of the code
    >> through rss, or intermittent reading of the trac site.

    >> There is also the psychological barrier of giving up complete
    >> ownership of the code, and accepting that people will write code that
    >> is different to the way I'd write it.

indeed. Probably that's the most important hurdle ...

    GaGr> If you already know svn then google code is very easy to use.  Setting
    GaGr> yourself up on it is really just a few minutes of work in that case.  I have
    GaGr> used other similar sites but google code is by far the easiest one to
    GaGr> work with of the ones I have tried. By default everyone has read access
    GaGr> and only you have write access so you still control the project.  You can
    GaGr> browse through the R projects that are already in google code here:
    GaGr> http://code.google.com/hosting/search?q=label:R

I would have thought  that R-forge (http://r-forge.r-project.org/)
was really the place (and infrastructure) such community
development of an R package should take place,
or .. why not?

Martin

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: plot graph with error bars trouble

hadley wickham
>     >> It's something I have thought a little bit about, but I haven't made
>     >> much progress. Ideally, if it's something that I do for ggplot2, I
>     >> should do it for all my other R packages too.
>
> I don't see why doing it for *some* package(s) should entail
> doing it for all of them

Perhaps that was worded too strongly - I meant say that I want a
system that will work for all of my packages, not just one.  ie. the
set up time for 10 packages shouldn't be prohibitive.

>     >> There is also the psychological barrier of giving up complete
>     >> ownership of the code, and accepting that people will write code that
>     >> is different to the way I'd write it.
>
> indeed. Probably that's the most important hurdle ...

But of course, necessary, if you want your project to live beyond you.

> I would have thought  that R-forge (http://r-forge.r-project.org/)
> was really the place (and infrastructure) such community
> development of an R package should take place,
> or .. why not?

The biggest drawback (to me) to both google code and R-forge, is their
failure to offer a nice interface to browser the svn repository and
view the timeline of changes.  I particularly like trac (e.g.
http://src.ggobi.org/) despite it's many problems, and I don't think I
want to do without that convenient view of my code.

Simon's r-forge (http://rforge.net) allows me to continue using my
existing infrastructure, but adds automated package building.  I can
use svn-externals to point it to my existing svn repository (or
probably a new one, which contains my public projects) and I can
continue to supply my own views of the repository.

I don't need any of the extra services that R R-forge provides
(mailing lists, forums, news, etc) and I don't find the "heavy" design
(containing links to everything you might possibly need, rather than
the bare minimum) particularly appealing.  (This is because of the
Gforge software, not any of the efforts of the R-forge developers)

I don't claim that this is the right solution for everyone, but I am
growing increasing certain it is the right solution for me.

Hadley

--
http://had.co.nz/

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: plot graph with error bars trouble

Gabor Grothendieck
On 10/1/07, hadley wickham <[hidden email]> wrote:
>
> The biggest drawback (to me) to both google code and R-forge, is their
> failure to offer a nice interface to browser the svn repository and
> view the timeline of changes.  I particularly like trac (e.g.
> http://src.ggobi.org/) despite it's many problems, and I don't think I
> want to do without that convenient view of my code.

Maybe you are referring to something else but both R-Forge and
Google code allow you to browse the svn repository over the
intenet from within a web browser.  In Google code click on the Source
tab and then the Subversion repository link.  For example,

Google code repo browser for proto package:
http://r-proto.googlecode.com/svn/

and for r-forge (which also supports timeline via web browser):

r-forge repo browser for zoo package
https://r-forge.r-project.org/plugins/scmsvn/viewcvs.php/pkg/?root=zoo

r-forge timeline of zoo.R
https://r-forge.r-project.org/plugins/scmsvn/viewcvs.php/pkg/R/zoo.R?rev=364&root=zoo&view=log

Depending on your svn client you may be able to do this as well.
TortoiseSVN on Windows lets one view the log/timeline for a particular file
or for all files and that would be independent of which svn repository
is used so use of such a client makes the feature less needed.

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: plot graph with error bars trouble

hadley wickham
On 10/1/07, Gabor Grothendieck <[hidden email]> wrote:

> On 10/1/07, hadley wickham <[hidden email]> wrote:
> >
> > The biggest drawback (to me) to both google code and R-forge, is their
> > failure to offer a nice interface to browser the svn repository and
> > view the timeline of changes.  I particularly like trac (e.g.
> > http://src.ggobi.org/) despite it's many problems, and I don't think I
> > want to do without that convenient view of my code.
>
> Maybe you are referring to something else but both R-Forge and
> Google code allow you to browse the svn repository over the
> intenet from within a web browser.  In Google code click on the Source
> tab and then the Subversion repository link.  For example,

Yes, but compare with:

http://src.ggobi.org/timeline for seeing what has changed recently and by who
http://src.ggobi.org/browser for easily navigating the repository and
setting back through revisions

You can also subscribe to the RSS feed of the project timeline to keep
track of what is changing.

Hadley

--
http://had.co.nz/

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: plot graph with error bars trouble

Gabor Grothendieck
On 10/1/07, hadley wickham <[hidden email]> wrote:

> On 10/1/07, Gabor Grothendieck <[hidden email]> wrote:
> > On 10/1/07, hadley wickham <[hidden email]> wrote:
> > >
> > > The biggest drawback (to me) to both google code and R-forge, is their
> > > failure to offer a nice interface to browser the svn repository and
> > > view the timeline of changes.  I particularly like trac (e.g.
> > > http://src.ggobi.org/) despite it's many problems, and I don't think I
> > > want to do without that convenient view of my code.
> >
> > Maybe you are referring to something else but both R-Forge and
> > Google code allow you to browse the svn repository over the
> > intenet from within a web browser.  In Google code click on the Source
> > tab and then the Subversion repository link.  For example,
>
> Yes, but compare with:
>
> http://src.ggobi.org/timeline for seeing what has changed recently and by who
> http://src.ggobi.org/browser for easily navigating the repository and
> setting back through revisions

These seem nearly identical to what you can get with R-Forge or with
TortoiseSVN (and likely other svn clients too).  Since any developer
is likely to have an svn client a web interface more sophisticated than
what is already available via the net has less utility than if this info were
not already available anyways.  Google code can send out email alerts.
On the other hand the complexity in dealing with Trac is a significant
disadvantage for projects the size of an R package.  I previously used Trac
for Ryacas but currently use a WISHLIST and NEWS file (both plain text
files created in a text editor) plus the svn log and find that adequate.
Clearly a lot of this is a matter of taste and of project size and there is no
right answer.

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: plot graph with error bars trouble

hadley wickham
> These seem nearly identical to what you can get with R-Forge or with
> TortoiseSVN (and likely other svn clients too).  Since any developer
> is likely to have an svn client a web interface more sophisticated than
> what is already available via the net has less utility than if this info were
> not already available anyways.  Google code can send out email alerts.
> On the other hand the complexity in dealing with Trac is a significant
> disadvantage for projects the size of an R package.  I previously used Trac
> for Ryacas but currently use a WISHLIST and NEWS file (both plain text
> files created in a text editor) plus the svn log and find that adequate.
> Clearly a lot of this is a matter of taste and of project size and there is no
> right answer.

That's true.  From my perspective, using a command line svn client on
OS X, I certainly prefer the web interface for exploring past commits.
 However, while any developer will have a svn client, a more casual
user or someone just interested in looking at the code won't, and I
don't think the google interface is that friendly.  (Mind you, that's
probably not a very common use case).

I'm not sure what problems you had with trac and a large repository -
it works very well for GGobi, with a repository that's almost 2 gig.
However, it did take me a long time to find a combination of web
server and trac setup that didn't crash every couple of days.  The
prevalence of trac spam also has lead me to turn off the wiki and bug
reporting.

I think it's good to have this discussion about package development so
that we can learn how others work.

Hadley


--
http://had.co.nz/

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: plot graph with error bars trouble

Gabor Grothendieck
On 10/1/07, hadley wickham <[hidden email]> wrote:

> > These seem nearly identical to what you can get with R-Forge or with
> > TortoiseSVN (and likely other svn clients too).  Since any developer
> > is likely to have an svn client a web interface more sophisticated than
> > what is already available via the net has less utility than if this info were
> > not already available anyways.  Google code can send out email alerts.
> > On the other hand the complexity in dealing with Trac is a significant
> > disadvantage for projects the size of an R package.  I previously used Trac
> > for Ryacas but currently use a WISHLIST and NEWS file (both plain text
> > files created in a text editor) plus the svn log and find that adequate.
> > Clearly a lot of this is a matter of taste and of project size and there is no
> > right answer.
>
> That's true.  From my perspective, using a command line svn client on
> OS X, I certainly prefer the web interface for exploring past commits.
>  However, while any developer will have a svn client, a more casual
> user or someone just interested in looking at the code won't, and I
> don't think the google interface is that friendly.  (Mind you, that's
> probably not a very common use case).
>
> I'm not sure what problems you had with trac and a large repository -
> it works very well for GGobi, with a repository that's almost 2 gig.
> However, it did take me a long time to find a combination of web
> server and trac setup that didn't crash every couple of days.  The
> prevalence of trac spam also has lead me to turn off the wiki and bug
> reporting.
>
> I think it's good to have this discussion about package development so
> that we can learn how others work.
>

I think the casual user just wants to browse the HEAD revision and that
is what google provides and makes easy to do since the interface is not
cluttered with a bunch of links that won't be used anyways.  If they want
more than that they are probably not a casual user but a developer and
have an svn client.

Regarding Trac I was able to use it successfully but its a large
complex system and it just took too much of my time investigating
all the numerous features.  I think its better suited to projects larger
than an R package.

By the way, there are some distributed version control systems that
work with svn such as svk that I had intended to investigate at some
point but so far have not found the time.

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Version control and R package development (was: plot graph with error bars trouble)

jiho
First a quick summary of the beginning of an interesting discussion  
(not all indented correctly but in the correct order at least):

> From: "Gabor Grothendieck" <[hidden email]>
> On 9/30/07, hadley wickham <[hidden email]> wrote:
>> On 9/30/07, jiho <[hidden email]> wrote:
>>> [...]
>>> BTW, have you thought about opening ggplot2 development (provide a
>>> way to check out the dev code and have the possibility to submit
>>> patches at least) or do you prefer to keep it a personal project for
>>> now? [...]
>>
>> It's something I have thought a little bit about, but I haven't made
>> much progress. Ideally, if it's something that I do for ggplot2, I
>> should do it for all my other R packages too.  I have thought about
>> setting up google code projects for each package, which would also
>> provide a nice set of bugtracking tools.  I've cc'd Gabor on this
>> email in the hope that he might describe his experiences with this
>> approach.
>>
>>> [...]
>>
>> The one thing that google code currently lacks is a nice timeline +
>> browser interface.  I find this very useful for GGobi
>> (http://src.ggobi.org) and would like to maintain that functionality
>> somehow.  It also makes it easier to track progress of the code
>> through rss, or intermittent reading of the trac site.
>>
>> [...]
>
> If you already know svn then google code is very easy to use.  Setting
> yourself up on it is really just a few minutes of work in that  
> case.  I have
> used other similar sites but google code is by far the easiest one to
> work with of the ones I have tried. By default everyone has read  
> access
> and only you have write access so you still control the project.  
> You can
> browse through the R projects that are already in google code here:
> http://code.google.com/hosting/search?q=label:R


> From: "hadley wickham" <[hidden email]>
> On 10/1/07, Gabor Grothendieck <[hidden email]> wrote:
>> On 10/1/07, hadley wickham <[hidden email]> wrote:
>>>
>>> The biggest drawback (to me) to both google code and R-forge, is  
>>> their
>>> failure to offer a nice interface to browser the svn repository and
>>> view the timeline of changes.  I particularly like trac (e.g.
>>> http://src.ggobi.org/) despite it's many problems, and I don't  
>>> think I
>>> want to do without that convenient view of my code.
>>
>> Maybe you are referring to something else but both R-Forge and
>> Google code allow you to browse the svn repository over the
>> intenet from within a web browser.  In Google code click on the  
>> Source
>> tab and then the Subversion repository link.  For example,
>
> Yes, but compare with:
>
> http://src.ggobi.org/timeline for seeing what has changed recently  
> and by who
> http://src.ggobi.org/browser for easily navigating the repository and
> setting back through revisions
>
> You can also subscribe to the RSS feed of the project timeline to keep
> track of what is changing.


On 2007-October-01  , at 20:24 , Gabor Grothendieck wrote:

> On 10/1/07, hadley wickham <[hidden email]> wrote:
>>> These seem nearly identical to what you can get with R-Forge or with
>>> TortoiseSVN (and likely other svn clients too).  Since any developer
>>> is likely to have an svn client a web interface more  
>>> sophisticated than
>>> what is already available via the net has less utility than if  
>>> this info were
>>> not already available anyways.  Google code can send out email  
>>> alerts.
>>> On the other hand the complexity in dealing with Trac is a  
>>> significant
>>> disadvantage for projects the size of an R package.  I previously  
>>> used Trac
>>> for Ryacas but currently use a WISHLIST and NEWS file (both plain  
>>> text
>>> files created in a text editor) plus the svn log and find that  
>>> adequate.
>>> Clearly a lot of this is a matter of taste and of project size  
>>> and there is no
>>> right answer.
>>
>> That's true.  From my perspective, using a command line svn client on
>> OS X, I certainly prefer the web interface for exploring past  
>> commits.
>>  However, while any developer will have a svn client, a more casual
>> user or someone just interested in looking at the code won't, and I
>> don't think the google interface is that friendly.  (Mind you, that's
>> probably not a very common use case).
>>
>> I'm not sure what problems you had with trac and a large repository -
>> it works very well for GGobi, with a repository that's almost 2 gig.
>> However, it did take me a long time to find a combination of web
>> server and trac setup that didn't crash every couple of days.  The
>> prevalence of trac spam also has lead me to turn off the wiki and bug
>> reporting.
>>
>> I think it's good to have this discussion about package  
>> development so
>> that we can learn how others work.
>
> I think the casual user just wants to browse the HEAD revision and  
> that
> is what google provides and makes easy to do since the interface is  
> not
> cluttered with a bunch of links that won't be used anyways.  If  
> they want
> more than that they are probably not a casual user but a developer and
> have an svn client.
>
> Regarding Trac I was able to use it successfully but its a large
> complex system and it just took too much of my time investigating
> all the numerous features.  I think its better suited to projects  
> larger
> than an R package.
>
> By the way, there are some distributed version control systems that
> work with svn such as svk that I had intended to investigate at some
> point but so far have not found the time.

OK, lots of interesting advice there. Here are my two additional cents.

I am using svn for all my personal development, which I think sums up  
to what a decent R package can be. I started with a local svn server  
and file:// operations and augmented the complexity of my setup  
progressively, until I recently thought about setting up Trac.  
However, as Gabor pointed out, it is non-trivial to set up and  
maintain and is probably too much for a project with a small number  
of contributors such as an R package (and was definitely too much for  
my own code!). I have been using the same setup for a few months now  
and it proved to be simple and stable but still feature full.

What I want from a version control system is:
- to provide version control on my files: revert changes, diff  
revisions etc. (obviously)
- to provide an history of the changes I did on the files (i.e. the  
logs)
- to provide an easy way of seeing what my files looked like, say 2  
weeks ago
- to let anyone browse the latest version easily (point people to a  
URL, et voilĂ )
- to be able to add contributors easily

The setup that allows me to do this without too much overhead is this  
one:
- svn repositories on a web-accessible server, in user space (i.e. /
home/some-name/)
- repositories served by Apache via a symbolic link from Apache's  
root. Apache provides simple access control rules (read for anyone,  
write with valid login+password. passwords stored in user space,  
encrypted): 15 minutes to set up, following the explanations of the  
svn book, chap 6 section "Basic HTTP Authentication", p 361.
- web interface to the repositories provided by webSVN. This also  
installs in user space, no Apache configuration is required (unless  
one wants URL rewrite -i.e. your repository to look like http://
www.someserver.com/svn/trunk/someFolder/someSubFolder/ in the addess  
bar- in which case you must allow .htaccess files to override  
Apache's defaults). 5 minutes to set up for the simple case, 10-15 to  
smooth everything with URL rewrite.

The end result looks like this:
        http://cbetm.univ-perp.fr/irisson/svn/
to see what an inner view looks like:
        http://cbetm.univ-perp.fr/irisson/svn/distribution_data/tetiaroa/ 
trunk/data/?rev=0&sc=1
You can play around with diffs, view logs, compare files etc.

This setup really helps me a lot in my day to day work. For a more  
collaborative project, its limitations are probably that it does not  
have patches/bug tracking though (it is not its point).

To conclude on the subject, I think that, if I was to choose a  
versioning system now that I know a little more abut them, I would  
probably choose git rather than svn, mainly because of two advantages:
- each checkout is a full repository (so each check out is a also a  
backup!) and works are a personal branch
- the possibility of finer grained 'commits'. when using git, one can  
use it as an hybrid between a distributed system and a central  
repository system: one publicly available checkout serves as the  
reference. Then, developers commit their changes to their private,  
local branch. These only become visible to the rest when "pushed" to  
the central reference checkout. Therefore, one can commit much more  
often, without the risk to disturb the reference version and then  
only push the changes when everything is right and tested. This  
allows the reference version to stay usable at all time while leaving  
freedom to the developers in their commits.
There are unfortunately much less tools available for git than for  
subversion but IMHO the model is, in itself, superior. I don't know  
the fine details about history of renamed files or copies between  
repositories in git though.

Hope that helps.

JiHO
---
http://jo.irisson.free.fr/

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Version control and R package development (was: plot graph with error bars trouble)

jiho

On 2007-October-01  , at 23:13 , jiho wrote:
> [...]
> The end result looks like this:
> http://cbetm.univ-perp.fr/irisson/svn/
> to see what an inner view looks like:
> http://cbetm.univ-perp.fr/irisson/svn/distribution_data/tetiaroa/ 
> trunk/data/?rev=0&sc=1
> You can play around with diffs, view logs, compare files etc.

Forgot to mention that it has RSS feeds also (this seemed important  
for Hadley), I just disabled them since they are of little utility  
for me.

Cheers,

JiHO
---
http://jo.irisson.free.fr/

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: plot graph with error bars trouble

Marcelo Luiz de Laia
In reply to this post by Jim Lemon
Dear Ben Bolker, Hadley Wickham, Jim Lemon and all

I'm very thank to you!

I tried all suggestion and I wiil comments it next.

Ben Bolker suggestion is very nice and I did a little changes in
col=c(1,1),pch=c(1,16) and I include a xlab,  ylab and a legend(5, 4,
c("02H02","306"), pch = c(1,16), col = c(1,1)). But, I didn't could
change the x-axis number division. Please, see:

I got sometings like this:

 |
 |
 |
 |
 |
+-----------------------------------------------------------
 0     5     10     15     20     25     30     35

and my times are 0, 8, 12, 16, 20, 24, 28, 32

I uploaded a .ps fle to http://www.divshare.com/download/2182957-d4e
showing the graph.

I searched for a function to change this division but I didn't found.
I looked at par() and default.plot() help pages for somethings that
change the 5 spacing to 4, than I will get 0, 4, 8, 12, ...

Hadley Wickham suggestion isn't possible to test because I got a error:

> means <- cast(df, Mutant + Time ~ ., c(mean, se))
Error in eval(expr, envir, enclos) : invalid 'envir' argument

I was searched for this error and got this to topics:
http://article.gmane.org/gmane.comp.lang.r.general/56890/match=error+eval+expr+envir+enclos+invalid+argument
http://article.gmane.org/gmane.comp.lang.r.general/87741/match=error+eval+expr+envir+enclos+invalid+argument

Than, I suppose that there are a problem, or with my dataset or with a
name of function. I didn't discovery it!

Here is my sessionInfo:

R version 2.5.1 (2007-06-27)
i386-pc-mingw32

locale:
LC_COLLATE=Portuguese_Brazil.1252;LC_CTYPE=Portuguese_Brazil.1252;LC_MONETARY=Portuguese_Brazil.1252;LC_NUMERIC=C;LC_TIME=Portuguese_Brazil.1252

attached base packages:
[1] "splines"   "grid"      "stats"     "graphics"  "grDevices"
"utils"     "datasets"  "methods"
[9] "base"

other attached packages:
     ggplot2   colorspace RColorBrewer         MASS        proto
reshape      plotrix
     "0.5.5"       "0.95"      "1.0-1"     "7.2-34"      "0.3-8"
"0.8.0"      "2.2-3"


Jim Lemon suggestion is very nice, but it plot the same point for one
Mutant before the some point of other Mutant in the same Time.

I uploaded a .ps file to divshare for clarify what I want to explain.
http://www.divshare.com/download/2182890-49c

and I uploaded a true dataset:
http://www.divshare.com/download/2182913-5a3

This is the result! Could you help me a little bit more?

I am very thank to you!!!

Best wishes

--
Marcelo Luiz de Laia

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: plot graph with error bars trouble

Jim Lemon
Marcelo Laia wrote:
 > ...

> ... but it plot the same point for one
> Mutant before the some point of other Mutant in the same Time.
>
> I uploaded a .ps file to divshare for clarify what I want to explain.
> http://www.divshare.com/download/2182890-49c
>
> and I uploaded a true dataset:
> http://www.divshare.com/download/2182913-5a3
>
> This is the result! Could you help me a little bit more?
>
Hi Marcelo,
If I read your message right, you don't want the points staggered. Try this:

ml.df<-read.table("../Marcelo_Laia.txt",header=TRUE)
brkdn.plot("OD","Mutant","Time",ml.df,stagger=0,pch=1:2,col=2:3)
legend(20,2,levels(ml.df$Mutant),pch=1:2,col=2:3,lty=1)

Jim

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.