Skip to content

Multiple line-plot

3 messages · David Studer, Dallas, John Kane

#
I think this is what you are getting at. Hope this helps. 


#index data to determine what low and high levels of tvHrs are (I said
anything over 15 hours is considered 'high')
index=which(tvHrs > 15)

#Plot the first plot, which is the 'high', only using values from crimeDvp
that are in 'index' (corresponding to high levels of tvHrs

plot(prop.table(table(crimeDvp[index])),type='b',ylab='percent',xlab='crime
dev',col='red')

lines(prop.table(table(crimeDvp[-index])),type='b', col='black')

lines(prop.table(table(crimeDvp)),type='b',col='green')

legend("topright", inset=.05, title="TV consume", c("high","low","all"),
fill=c('red','black','green'))



--
View this message in context: http://r.789695.n4.nabble.com/Multiple-line-plot-tp4394539p4395262.html
Sent from the R help mailing list archive at Nabble.com.
#
What are you expecting to get?

At the moment it appears that you are just ploting one data vector.  table() is giving you a one row table.

BTW you probably should not use data as a data.frame name. It is a reserved word.

John Kane
Kingston ON Canada
____________________________________________________________
Share photos & screenshots in seconds...
TRY FREE IM TOOLPACK at http://www.imtoolpack.com/default.aspx?rc=if1
Works in all emails, instant messengers, blogs, forums and social networks.