Pat Schmitz
unread,Sep 19, 2009, 5:30:43 PM9/19/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ggp...@googlegroups.com
I am using factored/ordered data, and
ggplot seems to be ignoring the factor order, and instead following the
continuous/numeric data order. I have attached a jpeg of an ouput plot, this ordering makes it really difficult to interpret the data, and I am sure I am missing something small. How do I get this to plot by factor correctly?
below is a subset of data, and attached is subset plotted
Data
time treatment variable value
4 08/25/09:N Ambient CO2 Control X10cm.mean 36.39274
16 08/25/09:N Ambient CO2 Control X20cm.mean 40.36536
28 08/25/09:N Ambient CO2 Control X30cm.mean 42.46743
40 08/25/09:N Ambient CO2 Control X40cm.mean 43.48431
52 08/25/09:N Ambient CO2 Control X50cm.mean 47.00896
64 08/25/09:N Ambient CO2 Control X60cm.mean 48.11792
76 08/25/09:N Ambient CO2 Control X70cm.mean 47.54671
88 08/25/09:N Ambient CO2 Control X80cm.mean 48.06299
100 08/25/09:N Ambient CO2 Control X90cm.mean 47.04015
112 08/25/09:N Ambient CO2 Control X100cm.mean 47.50861
form$time <- ordered(form$time)
form$treatment <- factor(form$factor)
form$variable <- ordered(form$variable)
form$time <- ordered(form$time)
Data Classes
> sapply(form, data.class)
time treatment variable value
"ordered" "factor" "ordered" "numeric"
Plot Code
p <- ggplot(form, aes(x=value, y=variable, group=treatment, colour=treatment))
p + geom_line() + geom_point()
--
Patrick Schmitz
Graduate Student
Plant Biology
1206 West Gregory Drive
RM 1500