The data isn't in a matrix yet. The data printed at the bottom of the jpg
are the means of the variables for each sampling time and I haven't
calculated the means yet. Does this mean that I have to get the means first
then use cbind to make a new matrix? The data looks like this:

   [site] [time] [transect] [coral] [deadcoral] [algae] [abiotic]
[softcoral]
[1,]  S1   t1        trans1    94            90         51     74
            83
[2,]  S1   t1        trans2    98            14         39      81
         1
[3,]  S1   t2        trans1    12            99         91      39
           21
[4,]  S1   t2        trans2     47           95         45      69
           91
[5,]  S2   t1        trans1     56            8          84      0
            61
[6,]  S2   t1        trans2     56            8          84      0
            61
[7,]  S2   t2        trans1     57            1          30      5
            40
[8,]  S2   t2        trans1     57            1          30      5
            40
.
.
.


On Wed, Oct 24, 2012 at 12:49 AM, David Carlson [via R] <
ml-node+s789695n4647176...@n4.nabble.com> wrote:

> If you have your data organized in a matrix like the one printed at the
> bottom of your jpg, barplot will produce the same graph:
>
> > set.seed(42)
> > a <- matrix(round(runif(45)*100, 0), nrow=5, ncol=9)
> > a
>      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9]
> [1,]   91   52   46   94   90   51   74   83   38
> [2,]   94   74   72   98   14   39   81    1   44
> [3,]   29   13   93   12   99   91   39   21    4
> [4,]   83   66   26   47   95   45   69   91   97
> [5,]   64   71   46   56    8   84    0   61   43
> > barplot(a)
> > barplot(a, beside=TRUE)
>
> -------------------------------------------------
> David L. Carlson
> Associate Professor of Anthropology
> Texas A&M University
> College Station, TX 77840
>
> -----Original Message-----
> From: [hidden 
> email]<http://user/SendEmail.jtp?type=node&node=4647176&i=0>[mailto:[hidden
> email] <http://user/SendEmail.jtp?type=node&node=4647176&i=1>]
> On Behalf Of Macy Anonuevo
> Sent: Tuesday, October 23, 2012 8:32 AM
> To: [hidden email] <http://user/SendEmail.jtp?type=node&node=4647176&i=2>
> Subject: Re: [R] plotting multiple variables in 1 bar graph
>
> Thank you for replying.
>
> On Tue, Oct 23, 2012 at 9:11 PM, PIKAL Petr [via R] <
> [hidden email] <http://user/SendEmail.jtp?type=node&node=4647176&i=3>>
> wrote:
>
> > Hi
> >
> >
> > > -----Original Message-----
> > > From: [hidden
> email]<http://user/SendEmail.jtp?type=node&node=4647131&i=0>[mailto:
> > r-help-bounces@r-
> > > project.org] On Behalf Of Macy Anonuevo
> > > Sent: Tuesday, October 23, 2012 10:23 AM
> > > To: [hidden
> email]<http://user/SendEmail.jtp?type=node&node=4647131&i=1>
> > > Subject: [R] plotting multiple variables in 1 bar graph
> > >
> > > I'd greatly appreciate your help in making a bar graph with multiple
> > > variables plotted on it. All the help sites I've seen so far only
> plot
> > > 1 variable on the y-axis
> > >
> > > Data set:
> > > I have 6 sites, each measured 5 times over the past year. During
> each
> > > sampling time, I counted the occurrences of different benthic
> > > components (coral, dead coral, sand, etc.) over 5 transects in each
> > > site
> > >
> > > site     time     transect     coral     deadcoral     sand
> rubble
> > > .....
> > > S1       time1   trans1        10           15                  10
> > > 4
> > > S1       time1   trans2         5             4
> 10
>
> > > 6
> > > S1      time1   trans3         10           2                     5
> > > 7
> > > .
> > > .
> > > .
> > > S5      time5    trans5     6            3                       1
> > > 6
> > >
> > > I used aggregate to get the means of the individual variables
> (coral,
> > > dead coral, etc.) using the site and time as grouping factors.
> > >
> > > aggregate.plot(deadcoral, by=list(SITE=site, TIME=time),
> FUN=c("mean"),
> > > error=c("sd"), legend.site="topright", bar.col=rainbow(6))
> >
> > Where is aggregate.plot from?
> >
>
> >> from the epicalc package.
>
>
>
> >
> > >
> > > What I need now is to plot all the variables in 1 site as they
> change
>
> > > over time.
> >
> > Something like
> >
> > barplot(VADeaths, beside = TRUE,
> >         col = c("lightblue", "mistyrose", "lightcyan",
> >                 "lavender", "cornsilk"),
> >         legend = rownames(VADeaths), ylim = c(0, 100))
> > title(main = "Death Rates in Virginia", font.main = 4)
> >
>
> >> If I understand the code correctly, this means that only the variable
> "VADeaths" is plotted over time? I'm hoping to have multiple variables
> plotted over time, with the bars clustered by variable so that you can
> see
> how each variable changes over time.
>
>
>
> >
> >
> > or maybe you could try ggplot2
> >
>
> >> I tried looking through ggplot2 and I don't understand the code. I
> don't
> even know where to start.
>
>
>
>
> >
> > Regards
> > Petr
> >
> >
> >
> > >
> > > What Excel produced:
> > >
> <http://r.789695.n4.nabble.com/file/n4647099/abdeens_benthic_cover.jpg>
> > > (The image has mean %cover as the y-value instead of mean count but
> the
> > > example still applies)
> > >
> > > I've spent several hours looking for code to do this but didn't find
> > > anything. I'd use the Excel graph except that it doesn't have the sd
> or
> > > se bars.
> > >
> > >
> > >
> > >
> > > --
> > > View this message in context:
> http://r.789695.n4.nabble.com/plotting-
> > > multiple-variables-in-1-bar-graph-tp4647099.html
> > > Sent from the R help mailing list archive at Nabble.com.
> > >
> > > ______________________________________________
> > > [hidden email]
> <http://user/SendEmail.jtp?type=node&node=4647131&i=2>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.
> >
> > ______________________________________________
> > [hidden email]
> <http://user/SendEmail.jtp?type=node&node=4647131&i=3>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.
> >
> >
> > ------------------------------
> >  If you reply to this email, your message will be added to the
> discussion
> > below:
> >
> >
> http://r.789695.n4.nabble.com/plotting-multiple-variables-in-1-bar-graph
> -tp4647099p4647131.html
> >  To unsubscribe from plotting multiple variables in 1 bar graph, click
> >
> here<http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=unsubs
> cribe_by_code&node=4647099&code=cmFkaWFudC5zdGFyc0BnbWFpbC5jb218NDY0NzA5
> OXwtNDIxODQ0NzMx>
> > .
> >
> NAML<http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=macro_
> viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces
> .BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web
> .template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.
> naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3A
> email.naml>
> >
>
>
>
> --
> Geekerie Shirts: shirts for the pop culture junkie -
> http://geekerie.multiply.com
> Sustainability in action: the official website of El Nido Resorts'
> Environment Department - http://elnidoenvironment.wordpress.com
>
>
>
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/plotting-multiple-variables-in-1-bar-graph
> -tp4647099p4647134.html
> Sent from the R help mailing list archive at Nabble.com.
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] <http://user/SendEmail.jtp?type=node&node=4647176&i=4>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.
>
> ______________________________________________
> [hidden email] <http://user/SendEmail.jtp?type=node&node=4647176&i=5>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.
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://r.789695.n4.nabble.com/plotting-multiple-variables-in-1-bar-graph-tp4647099p4647176.html
>  To unsubscribe from plotting multiple variables in 1 bar graph, click
> here<http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4647099&code=cmFkaWFudC5zdGFyc0BnbWFpbC5jb218NDY0NzA5OXwtNDIxODQ0NzMx>
> .
> NAML<http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: 
http://r.789695.n4.nabble.com/plotting-multiple-variables-in-1-bar-graph-tp4647099p4647179.html
Sent from the R help mailing list archive at Nabble.com.
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org 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 via email to