plotting multiple variables in 1 bar graph
Hi see in line
-----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r- project.org] On Behalf Of David Carlson Sent: Tuesday, October 23, 2012 6:47 PM To: 'Macy Anonuevo'; r-help at r-project.org Subject: Re: [R] plotting multiple variables in 1 bar graph
<snip>
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.
Not exactly. VADeaths is a matrix not a single variable.
str(VADeaths)
num [1:5, 1:4] 11.7 18.1 26.9 41 66 8.7 11.7 20.3 30.9 54.3 ... - attr(*, "dimnames")=List of 2 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ..$ : chr [1:5] "50-54" "55-59" "60-64" "65-69" ... ..$ : chr [1:4] "Rural Male" "Rural Female" "Urban Male" "Urban Female"
See ?barplot help page for details. Regards Petr
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:
(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:
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=unsub s cribe_by_code&node=4647099&code=cmFkaWFudC5zdGFyc0BnbWFpbC5jb218NDY0NzA 5 OXwtNDIxODQ0NzMx>
.
NAML<http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=macro _ viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespace s .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]]
______________________________________________ R-help at 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. ______________________________________________ R-help at 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.