Re: [R] Plot multiple lines, same plot, different axes?

2009-02-08 Thread Steve
Ron

 

It's Steve Thornton here from Leicester in the UK. Hope you are well. I got
your card and newsletter. It sounds like you're still travelling. If you get
this E-mail please mail me back as I'd like to keep in touch.

 

I've been trying to find your E-mail but you seem to have several. My last
messages got bounced back so I hope this one finds you.

 

Take care and hope to hear from you soon

 

Steve.

 


[[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.


[R] Plot multiple lines, same plot, different axes?

2008-12-19 Thread Ron Thornton
The plotrix package does this ().  However, maybe only for lines.

The code below will plot as many graphs of different types one on another,
and it contains a plot with a different axis. The graphs are self scaling
for y axis and date axis.

I have included background code for setting up date data, + the table used
for graphing.

(It looks much more intelligible in Tinn-R.)

 names(survis)
 [1] Province  District  SubDistrict   Village   Date
Activity  StatusRapidTestDone AnigenResult 
[10] HPAICompEvent

class(survis$Date)
[1] POSIXt  POSIXct

#SET UP DATA
survis2-survis
#rename fields
#Return date as month number
survismth-as.numeric(format(survis2$Date, %m))
#set up axis labels
date.bins - seq(from = min(survis2$Date), format = %d/%m/%y, to =
max(survis2$Date), format = %d/%m/%y, by = 1 month)
date.lab - as.character(date.bins, format = %b-%y)


print(join6)
   mthvis0   1 testsdone anigenpos testpercr
4 954  819 135   135   105 11.01
52090 1929 161   161   114  5.45
62723 2545 178   178   126  4.63
72600 2460 140   14093  3.58
82580 2392 188   188   106  4.11
92415 2240 175   175   104  4.31
10   2354 2263  919142  1.78
11   1595 1526  696936  2.26


#GRAPH THE RESULTS 
par(las=2)
mthlgth-max(survismth)-min(survismth)+1 
plotvis-barplot(join6[,mthvis],col=grey90,main=Visit numbers, test
numbers and HPAI detection rates\n - ALL PROVINCES,font.main=4,ylab=Number
of visits,border=grey20,ylim = c(0, max(join6[,mthvis]+20)), space=0,
xlim=c(0,mthlgth),names=date.lab)
#Second barplot overlying
par(new = TRUE)
plottests-barplot(join6[,anigenpos],col=dark green,space=0, axes=FALSE,
names.arg=, ylim=c(0, max(join6[,mthvis]+20)))  #no axes, ylim to align
y axis
#Create graph with second plot with second axis with different scale, with
points centred on barplot columns
par(new = TRUE)  ; par(las=0)
plotperc-plot(join6[,testpercr], type = o, axes = FALSE, bty = n,
xlab = , ylab=, col=red,lwd=2,lty=1, xlim=c(0.5,(mthlgth+0.5)))
axis(side=4, at = pretty(range(testpercr)), col=red, lwd=2)
mtext(HPAI diagnoses per 100 visits, side = 4, line = -1.15, outer =
FALSE, at = NA, adj = NA, padj = NA, cex = NA, col = NA, font = NA)
savePlot(filename = ALL PROVINCES, type = c(png), device = dev.cur())


Ron Thornton
ron.thorn...@fao.org

__
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.


Re: [R] Plot multiple lines, same plot, different axes?

2008-12-18 Thread Jim Lemon

zack holden wrote:

 Dear list,

 I would like to plot 2 series of numbers with very different 
ranges/scales as lines on the same
 plot. I assumed this is commonly done and easy, but I have not found 
any help files (e.g. axis()

 or matplot() that show how. I've searched many old posts to no avail.

 I'll be very grateful for any suggestions on how this is done.

Hi Zack,
If you have a look at the help page for twoord.plot in the plotrix 
package, it has some suggestions for avoiding misleading the viewer. It 
is possible that you might find gap.plot helpful as well.


Jim

__
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.


[R] Plot multiple lines, same plot, different axes?

2008-12-17 Thread zack holden

Dear list,
 
I would like to plot 2 series of numbers with very different ranges/scales as 
lines on the same plot. I assumed this is commonly done and easy, but I have 
not found any help files (e.g. axis() or matplot() that show how. I've searched 
many old posts to no avail. 
 
I'll be very grateful for any suggestions on how this is done. 
 
Best,
 
Zack
__
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.


Re: [R] Plot multiple lines, same plot, different axes?

2008-12-17 Thread Ben Bolker



zackfire wrote:
 
 
 Dear list,
  
 I would like to plot 2 series of numbers with very different ranges/scales
 as lines on the same plot. I assumed this is commonly done and easy, but I
 have not found any help files (e.g. axis() or matplot() that show how.
 I've searched many old posts to no avail. 
 

http://wiki.r-project.org/rwiki/doku.php?id=tips:graphics-base:2yaxes


-- 
View this message in context: 
http://www.nabble.com/Plot-multiple-lines%2C-same-plot%2C-different-axes--tp21058305p21058655.html
Sent from the R help mailing list archive at Nabble.com.

__
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.


Re: [R] Plot multiple lines, same plot, different axes?

2008-12-17 Thread Rolf Turner


On 18/12/2008, at 4:52 AM, zack holden wrote:



Dear list,

I would like to plot 2 series of numbers with very different ranges/ 
scales as lines on the same plot. I assumed this is commonly done  
and easy, but I have not found any help files (e.g. axis() or  
matplot() that show how. I've searched many old posts to no avail.


I'll be very grateful for any suggestions on how this is done.


***DON'T***!!!

cheers,

Rolf Turner

##
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

__
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.