Dear Elaine
I'm developing a code to make a 3 y-axes plot. It may can help you.
Also your question leads to mine, posted yesterday: How does R
calculate the interval between tick-marks.
Below follows the code I'm developing.
Data:
ANO CKG NUP NDE
2005 26352158 1500 25014
2006 32514789 2100 35024
2007 27458126 1800 30254
2008 28568971 1500 43254
2009 32564789 3000 60320
Code:
# I use comma as decimal symbol so I use dec=","
dat.caupde <- read.delim("clipboard",dec=",",header=T)
attach(dat.caupde)
summary(dat.caupde)
ANO CKG NUP NDE
Min. :2005 Min. :26352158 Min. :1500 Min. :25014
1st Qu.:2006 1st Qu.:27458126 1st Qu.:1500 1st Qu.:30254
Median :2007 Median :28568971 Median :1800 Median :35024
Mean :2007 Mean :29491767 Mean :1980 Mean :38773
3rd Qu.:2008 3rd Qu.:32514789 3rd Qu.:2100 3rd Qu.:43254
Max. :2009 Max. :32564789 Max. :3000 Max. :60320
# here I indicate the limits of each axes and calculate their ranges
y1min <- 26
y1max <- 33
y1range <- y1max-y1min
y2min <- 1500
y2max <- 3000
y2range <- y2max-y2min
y3min <- 25
y3max <- 61
y3range <- y3max-y3min
# making the plot
# y1range*((NUP-y2min)/y2range)+y1min calculates the proportion to
between axes
par(mar=c(6, 6, 2,12))
plot(CKG/1000000, ylim=c(y1min,y1max), ylab="landings (1000 t)",
type="l",col="red",las=0, cex.axis=1.2,cex.lab=1.4,xaxt="n",xlab="")
points( y1range*((NUP-y2min)/y2range)+y1min,type="l",col="blue")
points( y1range*((NDE/1000-y3min)/y3range)+y1min,type="l",col="darkgreen")
# the number 1 in axis(4,at=seq(y1min,y1max,1 ... is the interval
between each tick-mark
axis(1,at=1:5,labels=as.character(ANO),las=2,cex.axis=1.2)
axis(4,at=seq(y1min,y1max,1),labels=as.integer(seq(y2min,y2max,y2range/y1range)),las=0,cex.axis=1.2)
axis(4,at=seq(y1min,y1max,1),
labels=as.integer(seq(y3min,y3max,y3range/y1range)),cex.axis=1.2,
las=0,line=5)
mtext("nº of fishing boats",4,3,cex=1.4)
mtext("nº of fishing trips (x1000)",4,8, cex=1.4)
legend(4,33,c("L","Nº FB","Nº
FT"),bty="n",lty=c(1,1,1),col=c("red","blue","darkgreen"),cex=1.4)
Now I want to replace the number "1" by the formula used to calculate
the interval between tick-marks. Why, with the range 26-33, R choose
unitary intervals for the y axis (26, 27, 28 ...)?
All the best,
Antonio Olinto
Citando elaine kuo <elaine.kuo...@gmail.com>:
Dear List,
I have a richness data distributing across 20 N to 20 S latitude. (120 E-140
E longitude).
I would like to draw the richness in the north hemisphere and a regression
line in the plot
(x-axis: latitude, y-axis: richness in the north hemisphere).
The above demand is done using plot.
Then, south hemisphere richness and regression are required to be generated
using
the same y-axis above but an x-axis on the left side of the y-axis.
(The higher latitude in the south hemisphere, the left it would move)
Please kindly share how to design the south plot and regression line for
richness.
Also, please advise if any more info is in need.
Elaine
[[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.
----------------------------------------------------------------
Webmail - iBCMG Internet
http://www.ibcmg.com.br
______________________________________________
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.