View Full Version : How can you put 2 lines on a graph? Please help.
pchapman
09-27-2008, 02:09 AM
I am doing an MPH, and am learning to use R, but have got totally lost.
I have been given this question,
Plot the monthly deaths from pneumonia/influenza, and respiratory illness on
the same graph?
What would be the code for this?
Any help is greatly wellcom.
This is part of a code of mine.I plot the density of beta.draws nad overlay the density of another model using lines()
plot(density(fix.m7.1n.rj$beta.draws[i,]),ylim=c(0,k),main="",col="steelblue")
lines(density(fix.m7.1n.mc3$beta.draws[i,]),col="red");grid()
You should be careful regarding the plotting regions,though!
pchapman
09-27-2008, 05:14 AM
Thank you for your help. i have tried to fit you code into what i want, but its not working, what am i doing wrong?
> plot(tapply(deaths$pneu,deaths$year,mean),ylim=c(0,400),col="steelblue")lines(tapply(deaths$resp,deaths$year,mean),col="red");grid()
Error: unexpected symbol in "plot(tapply(deaths$pneu,deaths$year,mean),ylim=c(0,400),col="steelblue")lines"
>
It's the lines() part! You forgot the ";" in order to send all the commands at one time...
plot(tapply(deaths$pneu,deaths$year,mean),ylim=c(0 ,400),col="steelblue");lines(tapply(deaths$resp,dea ths$year,mean),col="red");grid()
there should be a tool, that "or"s two pictures ?! (.bmp)
Dason
03-31-2012, 11:59 AM
there should be a tool, that "or"s two pictures ?! (.bmp)
I recognize all of these words on their own. But put together it looks like gibberish.
it's AND, not OR since 255 is white. Make 2 charts in .bmp (one with each line) and merge them
by ANDing the pixeldata. I just thought, that would be useful so I tried it.
In C, not in R and I don't know what MPH is.
I found this by searching for influenza
Dason
04-02-2012, 09:19 AM
Ok - but the approach where you just plot two lines (given back in 2008) seems a lot simpler and more appropriate...
often I have the problem that I copy and paste a chart that I find on the web -
- then another one
- then I want them both in one chart
I'm using MS-paint ... maybe other software can do it
so I thought it's useful to have an ANDing of .bms utilities from commandline
also a colorchange (before the AND), change colorx to colory in whatever.bmp
and a size-change
in general I prefer working with DOS-commandline than with Windows
also a program that extracts the pixel positions from a chart
and stores the estimates function-values as data
Powered by vBulletin™ Version 4.1.3 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.