Hi Rosa,
I have had a moment to look at your code. First I think you should start
your device as:
quartz(width=12,height=5)
The split.screen code that I sent seems to work for me, giving the
3 4 5 6
2
7 8 9 10
layout of screens. To get the aspect ratio of the plots more similar, try
this:
# do the first split, to get the rightmost screen for the legend
split.screen(figs=matrix(c(0,0.84,0,1,0.84,1,0,1),nrow=2,byrow=TRUE))
# now split the first screen to get your eight screens (numbered 3 to 10)
for the plots
split.screen(figs=matrix(c(0,0.31,0.5,1,
0.31,0.54,0.5,1,
0.54,0.77,0.5,1,
0.77,1,0.5,1,
0,0.31,0,0.5,
0.31,0.54,0,0.5,
0.54,0.77,0,0.5,
0.77,1,0,0.5),
ncol=4,byrow=TRUE),screen=1)
I'm not sure of which plots should go on the top line and which on the
bottom, but I think you want margins like this:
screen(3)
par(mar=c(0,3.5,3,0))
screen(4)
par(mar=c(0,0,3,0))
screen(5)
par(mar=c(0,0,3,0))
screen(6)
par(mar=c(0,0,3,0))
screen(7)
par(mar=c(3,3.5,0,0))
screen(8)
par(mar=c(3,0,3,0))
screen(9)
par(mar=c(3,0,3,0))
screen(10)
par(mar=c(3,0,3,0))
Perhaps this will help.
Jim
On Fri, Sep 18, 2015 at 6:14 AM, Jim Lemon <drjimlemon at gmail.com>
wrote:
> Hi Rosa,
> I don't think the problem is with the split.screen command, for you are
> getting the eight plots and the screen at the right as you requested. It
> looks like your margins for each plot need adjusting, and I also think you
> should have about a 2.2 to 1 width to height ratio in the graphics device.
> I can't analyze the rest of the code at the moment, but perhaps
tomorrow if
> you can't work it out I can provide some suggestions.
>
> Jim
>
>
> On Fri, Sep 18, 2015 at 1:16 AM, Rosa Oliveira <rosita21 at
gmail.com> wrote:
>
>> Dear Jim,
>>
>> It works, nonetheless, it doesn't slip the screen correctly :(
>>
>> Do you have any idea?
>>
>>
>> I used the code:
>>
>>
>> #setwd("/Users/RO/Dropbox/LMER -
3rdproblem/R/latest_version/graphs/data")
>> setwd("~/Dropbox/LMER -
3rdproblem/R/latest_version/graphs/data")
>>
>>
>> library(ggplot2)
>> library(reshape)
>> library(lattice)
>>
>>
>> # read in what looks like half of the data
>>
>> bias.alpha2<-read.csv("graphs_bias_alpha2.csv")
>> SE.alpha2<-read.csv("graphs_SE_alpha2.csv")
>> bias.alpha1<-read.csv("graphs_bias_alpha1.csv")
>> SE.alpha1<-read.csv("graphs_SE_alpha1.csv")
>>
>>
>>
>> quartz(width=10,height=6)
>>
>> # do the first split, to get the rightmost screen for the legend
>> split.screen(figs=matrix(c(0,0.84,0,1,0.84,1,0,1),nrow=2,byrow=TRUE))
>> # now split the first screen to get your eight screens (numbered 3 to
10)
>> for the plots
>> split.screen(figs=matrix(c(0,0.25,0.5,1,
>> 0.25,0.5,0.5,1,
>> 0.5,0.75,0.5,1,
>> 0.75,1,0.5,1,
>> 0,0.25,0,0.5,
>> 0.25,0.5,0,0.5,
>> 0.5,0.75,0,0.5,
>> 0.75,1,0,0.5),
>> ncol=4,byrow=TRUE),screen=1)
>>
>>
>>
>> #split.screen(figs=matrix(c(0,0.5,0.5,1,#primeira linha primeira coluna
>> # 0.5,1,0.5,1,#primeira linha segunda coluna
>> # 0,0.5,0,0.5,#segunda linha primeira coluna
>> # 0.5,1,0,0.5),#segunda linha segunda coluna
>> # ncol=4,byrow=TRUE),screen=1)
>>
>>
>> # this produces seven screens numbered like this:
>> # 3 4 5 6
>> # 2
>> # 7 8 9 10
>> # select the upper left screen
>>
>>
>>
>> screen(3)
>> par(mar=c(0,3.5,3,0))
>> # now the second set
>> n250<-bias.alpha1$nsample==250
>> matplot(x=bias.alpha1$lambda[n250],y=bias.alpha1[n250,3:5],
>>
type="l",pch=1:3,col=c(4,2,3),xaxt="n",ylim=c(-.1,
>> .6),main="nsample=250",ylab="", cex.main=1)
>> abline(h = 0, col = "gray60")
>> mtext(expression(paste("Bias av. for
",alpha[1])),side=2,line=2,
>> cex.main=1)
>>
>> screen(4)
>> par(mar=c(0,0,3,0))
>> # now the second set
>> n1000<-bias.alpha1$nsample==1000
>> matplot(x=bias.alpha1$lambda[n1000],y=bias.alpha1[n1000,3:5],
>>
type="l",pch=1:3,col=c(4,2,3),xaxt="n",yaxt="n",ylim=c(-.1,
>> .6),main="nsample=1000",ylab="")
>> abline(h = 0, col = "gray60")
>>
>>
>>
>> screen(5)
>> par(mar=c(0,3.5,3,0))
>> # now the second set
>> par(mar=c(3,3.5,0,0))
>> # now the second set
>> n250<-bias.alpha2$nsample==250
>> matplot(x=bias.alpha2$lambda[n250],y=bias.alpha2[n250,3:5],
>> type="l",pch=1:3,col=c(4,2,3),ylim=c(-.1,
.6),ylab="")
>> abline(h = 0, col = "gray60")
>> mtext(expression(paste("Bias av. for
",alpha[2])),side=2,line=2,
>> cex.main=1.5)
>>
>> screen(6)
>> par(mar=c(3,0,0,0))
>> # now the second set
>> n1000<-bias.alpha2$nsample==1000
>> matplot(x=bias.alpha2$lambda[n1000],y=bias.alpha2[n1000,3:5],
>>
type="l",pch=1:3,col=c(4,2,3),yaxt="n",ylim=c(-.1, .6))
>> abline(h = 0, col = "gray60")
>>
>>
>>
>>
>> screen(7)
>> par(mar=c(0,3.5,3,0))
>> # now the second set
>> n250<-SE.alpha1$nsample==250
>> matplot(x=SE.alpha1$lambda[n250],y=SE.alpha1[n250,3:5],
>>
type="l",pch=1:3,col=c(4,2,3),xaxt="n",ylim=c(0,
>> 1.1),main="nsample=250",ylab="", cex.main=1)
>> abline(h = -1, col = "gray60")
>> mtext(expression(paste("SE av. for
",alpha[1])),side=2,line=2,
>> cex.main=1)
>> mtext(expression(paste(lambda)),side=1,line=2, cex.main=1.5)
>>
>>
>> screen(8)
>> par(mar=c(0,0,3,0))
>> # now the second set
>> n1000<-SE.alpha1$nsample==1000
>> matplot(x=SE.alpha1$lambda[n1000],y=SE.alpha1[n1000,3:5],
>>
type="l",pch=1:3,col=c(4,2,3),xaxt="n",yaxt="n",ylim=c(0,
>> 1.1),main="nsample=1000",ylab="")
>> abline(h = -1, col = "gray60")
>>
>>
>>
>>
>> screen(9)
>> par(mar=c(3,3.5,0,0))
>> # now the second set
>> n250<-SE.alpha2$nsample==250
>> matplot(x=SE.alpha2$lambda[n250],y=SE.alpha2[n250,3:5],
>> type="l",pch=1:3,col=c(4,2,3),ylim=c(0,
1.1),ylab="")
>> abline(h = -.5, col = "gray60")
>> mtext(expression(paste("SE av. for
",alpha[2])),side=2,line=2,
>> cex.main=1.5)
>> mtext(expression(paste(lambda)),side=1,line=2, cex.main=1.5)
>>
>>
>> screen(10)
>> par(mar=c(3,0,0,0))
>> # now the second set
>> n1000<-SE.alpha2$nsample==1000
>> matplot(x=SE.alpha2$lambda[n1000],y=SE.alpha2[n1000,3:5],
>>
type="l",pch=1:3,col=c(4,2,3),yaxt="n",ylim=c(0, 1.1))
>> abline(h = -.5, col = "gray60")
>> mtext(expression(paste(lambda)),side=1,line=2, , cex.main=1.5)
>>
>>
>>
>> screen(2)
>> par(mar=c(0,0,0,0))
>> # plot an empty plot to get the coordinates
>> plot(0:1,0:1,type="n",axes=FALSE)
>> legend(0,0.6,c("OLS", "GLS", "Reg. Cal.",
"0"),bty = "n",
>> lty=1:3,col=c(4,2,3,"gray60"),xpd=TRUE)
>>
>>
>> close.screen(all=TRUE)
>>
>>
>> and I attach the output graph.
>>
>>
>>
>> Best,
>> RO
>>
>> Atenciosamente,
>> Rosa Oliveira
>>
>> _________________________________
>>
>> Antes de imprimir este e-mail pense bem se tem mesmo que o fazer.
>> H? cada vez menos ?rvores.
>> N?o imprima, pense na sua responsabilidade e compromisso com o MEIO
>> AMBIENTE!
>>
>>
<http://pt.dreamstime.com/cora-ccedil-atildeo-criado-das-folhas-de-aacutervores-diferentes-thumb12275776.jpg>
>>
>>
<http://pt.dreamstime.com/cora-ccedil-atildeo-criado-das-folhas-de-aacutervores-diferentes-thumb12275776.jpg>
>>
>> 2015-09-17 12:18 GMT+01:00 Jim Lemon <drjimlemon at gmail.com>:
>>
>>> Hi Rosa,
>>> Try this:
>>>
>>> # do the first split, to get the rightmost screen for the legend
>>>
split.screen(figs=matrix(c(0,0.84,0,1,0.84,1,0,1),nrow=2,byrow=TRUE))
>>> # now split the first screen to get your eight screens (numbered 3
to
>>> 10) for the plots
>>> split.screen(figs=matrix(c(0,0.25,0.5,1,
>>> 0.25,0.5,0.5,1,
>>> 0.5,0.75,0.5,1,
>>> 0.75,1,0.5,1,
>>> 0,0.25,0,0.5,
>>> 0.25,0.5,0,0.5,
>>> 0.5,0.75,0,0.5,
>>> 0.75,1,0,0.5),
>>> ncol=4,byrow=TRUE),screen=1)
>>>
>>> Jim
>>>
>>>
>>> On Thu, Sep 17, 2015 at 2:45 AM, Rosa Oliveira <rosita21 at
gmail.com>
>>> wrote:
>>>
>>>> Dear all,
>>>>
>>>> I?m trying to do a graph,
>>>>
>>>> 3 rows, 5 columns, with the design:
>>>> # 3 4 5 6
>>>> # 2
>>>> # 7 8 9 10
>>>>
>>>> I had a code for 3 rows, 3 columns, with the design::
>>>> # 3 4
>>>> # 2
>>>> # 7 8
>>>> and I tried to modify it, but I had no success :(
>>>>
>>>> I suppose the problem is in the slip.screen code (red part of
the code).
>>>>
>>>> I attach my code, can anyone please help me?
>>>>
>>>>
>>>> Best,
>>>> RO
>>>>
>>>>
>>>> setwd("/Users/RO/Dropbox/LMER -
>>>> 3rdproblem/R/latest_version/graphs/data")
>>>>
>>>> library(ggplot2)
>>>> library(reshape)
>>>> library(lattice)
>>>>
>>>>
>>>> # read in what looks like half of the data
>>>>
>>>> bias.alpha2<-read.csv("graphs_bias_alpha2.csv")
>>>> SE.alpha2<-read.csv("graphs_SE_alpha2.csv")
>>>> bias.alpha1<-read.csv("graphs_bias_alpha1.csv")
>>>> SE.alpha1<-read.csv("graphs_SE_alpha1.csv")
>>>>
>>>>
>>>>
>>>> quartz(width=10,height=6)
>>>> # do the first split, to get the rightmost screen for the
legend
>>>>
split.screen(figs=matrix(c(0,0.8,0,1,0.8,1,0,1),nrow=2,byrow=TRUE))
>>>> # now split the first screen to get your six screens for the
plots
>>>>
>>>>
>>>>
>>>> split.screen(figs=matrix(c(0,0.5,0.5,1,#primeira linha primeira
coluna
>>>> 0.5,1,0.5,1,#primeira linha segunda
coluna
>>>> 0,0.5,0,0.5,#segunda linha primeira
coluna
>>>> 0.5,1,0,0.5),#segunda linha segunda
coluna
>>>> ncol=4,byrow=TRUE),screen=1)
>>>>
>>>>
>>>> # this produces seven screens numbered like this:
>>>> # 3 4 5 6
>>>> # 2
>>>> # 7 8 9 10
>>>> # select the upper left screen
>>>>
>>>>
>>>>
>>>> screen(3)
>>>> par(mar=c(0,3.5,3,0))
>>>> # now the second set
>>>> n250<-bias.alpha1$nsample==250
>>>> matplot(x=bias.alpha1$lambda[n250],y=bias.alpha1[n250,3:5],
>>>>
type="l",pch=1:3,col=c(4,2,3),xaxt="n",ylim=c(-.1,
>>>> .6),main="nsample=250",ylab="", cex.main=1)
>>>> abline(h = 0, col = "gray60")
>>>> mtext(expression(paste("Bias av. for
",alpha[1])),side=2,line=2,
>>>> cex.main=1)
>>>>
>>>> screen(4)
>>>> par(mar=c(0,0,3,0))
>>>> # now the second set
>>>> n1000<-bias.alpha1$nsample==1000
>>>> matplot(x=bias.alpha1$lambda[n1000],y=bias.alpha1[n1000,3:5],
>>>>
type="l",pch=1:3,col=c(4,2,3),xaxt="n",yaxt="n",ylim=c(-.1,
>>>> .6),main="nsample=1000",ylab="")
>>>> abline(h = 0, col = "gray60")
>>>>
>>>>
>>>>
>>>> screen(5)
>>>> par(mar=c(0,3.5,3,0))
>>>> # now the second set
>>>> par(mar=c(3,3.5,0,0))
>>>> # now the second set
>>>> n250<-bias.alpha2$nsample==250
>>>> matplot(x=bias.alpha2$lambda[n250],y=bias.alpha2[n250,3:5],
>>>> type="l",pch=1:3,col=c(4,2,3),ylim=c(-.1,
.6),ylab="")
>>>> abline(h = 0, col = "gray60")
>>>> mtext(expression(paste("Bias av. for
",alpha[2])),side=2,line=2,
>>>> cex.main=1.5)
>>>>
>>>> screen(6)
>>>> par(mar=c(3,0,0,0))
>>>> # now the second set
>>>> n1000<-bias.alpha2$nsample==1000
>>>> matplot(x=bias.alpha2$lambda[n1000],y=bias.alpha2[n1000,3:5],
>>>>
type="l",pch=1:3,col=c(4,2,3),yaxt="n",ylim=c(-.1, .6))
>>>> abline(h = 0, col = "gray60")
>>>>
>>>>
>>>>
>>>>
>>>> screen(7)
>>>> par(mar=c(0,3.5,3,0))
>>>> # now the second set
>>>> n250<-SE.alpha1$nsample==250
>>>> matplot(x=SE.alpha1$lambda[n250],y=SE.alpha1[n250,3:5],
>>>>
type="l",pch=1:3,col=c(4,2,3),xaxt="n",ylim=c(0,
>>>> 1.1),main="nsample=250",ylab="",
cex.main=1)
>>>> abline(h = -1, col = "gray60")
>>>> mtext(expression(paste("SE av. for
",alpha[1])),side=2,line=2,
>>>> cex.main=1)
>>>> mtext(expression(paste(lambda)),side=1,line=2, cex.main=1.5)
>>>>
>>>>
>>>> screen(8)
>>>> par(mar=c(0,0,3,0))
>>>> # now the second set
>>>> n1000<-SE.alpha1$nsample==1000
>>>> matplot(x=SE.alpha1$lambda[n1000],y=SE.alpha1[n1000,3:5],
>>>>
type="l",pch=1:3,col=c(4,2,3),xaxt="n",yaxt="n",ylim=c(0,
>>>> 1.1),main="nsample=1000",ylab="")
>>>> abline(h = -1, col = "gray60")
>>>>
>>>>
>>>>
>>>>
>>>> screen(9)
>>>> par(mar=c(3,3.5,0,0))
>>>> # now the second set
>>>> n250<-SE.alpha2$nsample==250
>>>> matplot(x=SE.alpha2$lambda[n250],y=SE.alpha2[n250,3:5],
>>>> type="l",pch=1:3,col=c(4,2,3),ylim=c(0,
1.1),ylab="")
>>>> abline(h = -.5, col = "gray60")
>>>> mtext(expression(paste("SE av. for
",alpha[2])),side=2,line=2,
>>>> cex.main=1.5)
>>>> mtext(expression(paste(lambda)),side=1,line=2, cex.main=1.5)
>>>>
>>>>
>>>> screen(10)
>>>> par(mar=c(3,0,0,0))
>>>> # now the second set
>>>> n1000<-SE.alpha2$nsample==1000
>>>> matplot(x=SE.alpha2$lambda[n1000],y=SE.alpha2[n1000,3:5],
>>>>
type="l",pch=1:3,col=c(4,2,3),yaxt="n",ylim=c(0, 1.1))
>>>> abline(h = -.5, col = "gray60")
>>>> mtext(expression(paste(lambda)),side=1,line=2, , cex.main=1.5)
>>>>
>>>>
>>>>
>>>> screen(2)
>>>> par(mar=c(0,0,0,0))
>>>> # plot an empty plot to get the coordinates
>>>> plot(0:1,0:1,type="n",axes=FALSE)
>>>> legend(0,0.6,c("OLS", "GLS", "Reg.
Cal.", "0"),bty = "n",
>>>> lty=1:3,col=c(4,2,3,"gray60"),xpd=TRUE)
>>>>
>>>>
>>>> close.screen(all=TRUE)
>>>>
>>>>
>>>>
>>>>
>>>> Best,
>>>> RO
>>>>
>>>>
>>>> Atenciosamente,
>>>> Rosa Oliveira
>>>>
>>>> --
>>>>
>>>>
____________________________________________________________________________
>>>>
>>>>
>>>> Rosa Celeste dos Santos Oliveira,
>>>>
>>>> E-mail: rosita21 at gmail.com
>>>> Tlm: +351 939355143
>>>> Linkedin: https://pt.linkedin.com/in/rosacsoliveira
>>>>
>>>>
____________________________________________________________________________
>>>> "Many admire, few know"
>>>> Hippocrates
>>>>
>>>> ______________________________________________
>>>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and
more, see
>>>> 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.
>>>
>>>
>>>
>>
>
[[alternative HTML version deleted]]
Dear Jim,
I?ve tried till today, but I could not solve the problems.
1. despite the scales are the same (equal: lambda ={0.70, 0.75, 0.80, 0.85,
0.90, 0.95, 0.98}), the "matrix" is not equal. If you see, for n = 250
the column is narrower than for n = 1000, and "lambda" has the same
values.
2. the first 2 columns relate to alpha 1 and the second two columns alpha2. Is
it possible to place a title above nsample that concerns the first 2 columns and
other over the last 2?
something like:
alpha1
alpha2
nsample=250 nsample=1000 nsample=250 nsample=1000
3. Notice that have 4 separate drawings and must place the 4 "groups"
together.
Can you help?
It's really important.
Best,
RO
library(ggplot2)
library(reshape)
library(lattice)
# read in what looks like half of the data
bias.alpha2<-read.csv("graphs_bias_alpha2.csv")
SE.alpha2<-read.csv("graphs_SE_alpha2.csv")
bias.alpha1<-read.csv("graphs_bias_alpha1.csv")
SE.alpha1<-read.csv("graphs_SE_alpha1.csv")
quartz(width=10,height=6)
# do the first split, to get the rightmost screen for the legend
split.screen(figs=matrix(c(0,0.84,0,1,0.84,1,0,1),nrow=2,byrow=TRUE))
# now split the first screen to get your eight screens (numbered 3 to 10) for
the plots
split.screen(figs=matrix(c(0,0.25,0.5,1,
0.25,0.5,0.5,1,
0.5,0.75,0.5,1,
0.75,1,0.5,1,
0,0.25,0,0.5,
0.25,0.5,0,0.5,
0.5,0.75,0,0.5,
0.75,1,0,0.5),
ncol=4,byrow=TRUE),screen=1)
#split.screen(figs=matrix(c(0,0.5,0.5,1,#primeira linha primeira coluna
# 0.5,1,0.5,1,#primeira linha segunda coluna
# 0,0.5,0,0.5,#segunda linha primeira coluna
# 0.5,1,0,0.5),#segunda linha segunda coluna
# ncol=4,byrow=TRUE),screen=1)
# this produces seven screens numbered like this:
# 3 4 5 6
# 2
# 7 8 9 10
# select the upper left screen
screen(3)
par(mar=c(0,3.5,3,0))
# now the second set
n250<-bias.alpha1$nsample==250
matplot(x=bias.alpha1$lambda[n250],y=bias.alpha1[n250,3:5],
type="l",pch=1:3,col=c(4,2,3),xaxt="n",ylim=c(-.1,
.6),main="nsample=250",ylab="", cex.main=1)
abline(h = 0, col = "gray60")
mtext(expression(paste("Bias av. for ",alpha[1])),side=2,line=2,
cex.main=1)
screen(4)
par(mar=c(0,0,3,0))
# now the second set
n1000<-bias.alpha1$nsample==1000
matplot(x=bias.alpha1$lambda[n1000],y=bias.alpha1[n1000,3:5],
type="l",pch=1:3,col=c(4,2,3),xaxt="n",yaxt="n",ylim=c(-.1,
.6),main="nsample=1000",ylab="")
abline(h = 0, col = "gray60")
screen(5)
par(mar=c(0,3.5,3,0))
# now the second set
par(mar=c(3,3.5,0,0))
# now the second set
n250<-bias.alpha2$nsample==250
matplot(x=bias.alpha2$lambda[n250],y=bias.alpha2[n250,3:5],
type="l",pch=1:3,col=c(4,2,3),xaxt="n",yaxt="n",ylim=c(-.1,
.6),main="nsample=250",ylab="")
abline(h = 0, col = "gray60")
screen(6)
par(mar=c(3,0,0,0))
# now the second set
n1000<-bias.alpha2$nsample==1000
matplot(x=bias.alpha2$lambda[n1000],y=bias.alpha2[n1000,3:5],
type="l",pch=1:3,col=c(4,2,3),xaxt="n",yaxt="n",ylim=c(-.1,
.6),main="nsample=1000",ylab="")
abline(h = 0, col = "gray60")
screen(7)
par(mar=c(0,3.5,3,0))
# now the second set
n250<-SE.alpha1$nsample==250
matplot(x=SE.alpha1$lambda[n250],y=SE.alpha1[n250,3:5],
type="l",pch=1:3,col=c(4,2,3),ylim=c(0,
1.1),main="nsample=250",ylab="", cex.main=1)
abline(h = -1, col = "gray60")
mtext(expression(paste("SE av. for ",alpha[1])),side=2,line=2,
cex.main=1)
mtext(expression(paste(lambda)),side=1,line=2, cex.main=1.5)
screen(8)
par(mar=c(0,0,3,0))
# now the second set
n1000<-SE.alpha1$nsample==1000
matplot(x=SE.alpha1$lambda[n1000],y=SE.alpha1[n1000,3:5],
type="l",pch=1:3,col=c(4,2,3),yaxt="n",ylim=c(0,
1.1),main="nsample=1000",ylab="")
abline(h = -1, col = "gray60")
screen(9)
par(mar=c(3,3.5,0,0))
# now the second set
n250<-SE.alpha2$nsample==250
matplot(x=SE.alpha2$lambda[n250],y=SE.alpha2[n250,3:5],
type="l",pch=1:3,col=c(4,2,3),yaxt="n",ylim=c(0,
1.1),ylab="")
abline(h = -.5, col = "gray60")
mtext(expression(paste(lambda)),side=1,line=2, cex.main=1.5)
screen(10)
par(mar=c(3,0,0,0))
# now the second set
n1000<-SE.alpha2$nsample==1000
matplot(x=SE.alpha2$lambda[n1000],y=SE.alpha2[n1000,3:5],
type="l",pch=1:3,col=c(4,2,3),yaxt="n",ylim=c(0,
1.1),ylab="")
abline(h = -1, col = "gray60")
mtext(expression(paste(lambda)),side=1,line=2, , cex.main=1.5)
screen(2)
par(mar=c(0,0,0,0))
# plot an empty plot to get the coordinates
plot(0:1,0:1,type="n",axes=FALSE)
legend(0,0.6,c("OLS", "GLS", "Reg. Cal.",
"0"),bty = "n",
lty=1:3,col=c(4,2,3,"gray60"),xpd=TRUE)
close.screen(all=TRUE)
Atenciosamente,
Rosa Oliveira
--
____________________________________________________________________________
Rosa Celeste dos Santos Oliveira,
E-mail: rosita21 at gmail.com
Tlm: +351 939355143
Linkedin: https://pt.linkedin.com/in/rosacsoliveira
____________________________________________________________________________
"Many admire, few know"
Hippocrates
> On 18 Sep 2015, at 10:38, Jim Lemon <drjimlemon at gmail.com> wrote:
>
> Hi Rosa,
> I have had a moment to look at your code. First I think you should start
your device as:
>
> quartz(width=12,height=5)
>
> The split.screen code that I sent seems to work for me, giving the
>
> 3 4 5 6
> 2
> 7 8 9 10
>
> layout of screens. To get the aspect ratio of the plots more similar, try
this:
>
> # do the first split, to get the rightmost screen for the legend
> split.screen(figs=matrix(c(0,0.84,0,1,0.84,1,0,1),nrow=2,byrow=TRUE))
> # now split the first screen to get your eight screens (numbered 3 to 10)
for the plots
> split.screen(figs=matrix(c(0,0.31,0.5,1,
> 0.31,0.54,0.5,1,
> 0.54,0.77,0.5,1,
> 0.77,1,0.5,1,
> 0,0.31,0,0.5,
> 0.31,0.54,0,0.5,
> 0.54,0.77,0,0.5,
> 0.77,1,0,0.5),
> ncol=4,byrow=TRUE),screen=1)
>
> I'm not sure of which plots should go on the top line and which on the
bottom, but I think you want margins like this:
>
> screen(3)
> par(mar=c(0,3.5,3,0))
> screen(4)
> par(mar=c(0,0,3,0))
> screen(5)
> par(mar=c(0,0,3,0))
> screen(6)
> par(mar=c(0,0,3,0))
> screen(7)
> par(mar=c(3,3.5,0,0))
> screen(8)
> par(mar=c(3,0,3,0))
> screen(9)
> par(mar=c(3,0,3,0))
> screen(10)
> par(mar=c(3,0,3,0))
>
> Perhaps this will help.
>
> Jim
>
>
> On Fri, Sep 18, 2015 at 6:14 AM, Jim Lemon <drjimlemon at gmail.com
<mailto:drjimlemon at gmail.com>> wrote:
> Hi Rosa,
> I don't think the problem is with the split.screen command, for you are
getting the eight plots and the screen at the right as you requested. It looks
like your margins for each plot need adjusting, and I also think you should have
about a 2.2 to 1 width to height ratio in the graphics device. I can't
analyze the rest of the code at the moment, but perhaps tomorrow if you
can't work it out I can provide some suggestions.
>
> Jim
>
>
> On Fri, Sep 18, 2015 at 1:16 AM, Rosa Oliveira <rosita21 at gmail.com
<mailto:rosita21 at gmail.com>> wrote:
> Dear Jim,
>
> It works, nonetheless, it doesn't slip the screen correctly :(
>
> Do you have any idea?
>
>
> I used the code:
>
>
> #setwd("/Users/RO/Dropbox/LMER -
3rdproblem/R/latest_version/graphs/data")
> setwd("~/Dropbox/LMER - 3rdproblem/R/latest_version/graphs/data")
>
>
> library(ggplot2)
> library(reshape)
> library(lattice)
>
>
> # read in what looks like half of the data
>
> bias.alpha2<-read.csv("graphs_bias_alpha2.csv")
> SE.alpha2<-read.csv("graphs_SE_alpha2.csv")
> bias.alpha1<-read.csv("graphs_bias_alpha1.csv")
> SE.alpha1<-read.csv("graphs_SE_alpha1.csv")
>
>
>
> quartz(width=10,height=6)
>
> # do the first split, to get the rightmost screen for the legend
> split.screen(figs=matrix(c(0,0.84,0,1,0.84,1,0,1),nrow=2,byrow=TRUE))
> # now split the first screen to get your eight screens (numbered 3 to 10)
for the plots
> split.screen(figs=matrix(c(0,0.25,0.5,1,
> 0.25,0.5,0.5,1,
> 0.5,0.75,0.5,1,
> 0.75,1,0.5,1,
> 0,0.25,0,0.5,
> 0.25,0.5,0,0.5,
> 0.5,0.75,0,0.5,
> 0.75,1,0,0.5),
> ncol=4,byrow=TRUE),screen=1)
>
>
>
> #split.screen(figs=matrix(c(0,0.5,0.5,1,#primeira linha primeira coluna
> # 0.5,1,0.5,1,#primeira linha segunda coluna
> # 0,0.5,0,0.5,#segunda linha primeira coluna
> # 0.5,1,0,0.5),#segunda linha segunda coluna
> # ncol=4,byrow=TRUE),screen=1)
>
>
> # this produces seven screens numbered like this:
> # 3 4 5 6
> # 2
> # 7 8 9 10
> # select the upper left screen
>
>
>
> screen(3)
> par(mar=c(0,3.5,3,0))
> # now the second set
> n250<-bias.alpha1$nsample==250
> matplot(x=bias.alpha1$lambda[n250],y=bias.alpha1[n250,3:5],
>
type="l",pch=1:3,col=c(4,2,3),xaxt="n",ylim=c(-.1,
.6),main="nsample=250",ylab="", cex.main=1)
> abline(h = 0, col = "gray60")
> mtext(expression(paste("Bias av. for ",alpha[1])),side=2,line=2,
cex.main=1)
>
> screen(4)
> par(mar=c(0,0,3,0))
> # now the second set
> n1000<-bias.alpha1$nsample==1000
> matplot(x=bias.alpha1$lambda[n1000],y=bias.alpha1[n1000,3:5],
>
type="l",pch=1:3,col=c(4,2,3),xaxt="n",yaxt="n",ylim=c(-.1,
.6),main="nsample=1000",ylab="")
> abline(h = 0, col = "gray60")
>
>
>
> screen(5)
> par(mar=c(0,3.5,3,0))
> # now the second set
> par(mar=c(3,3.5,0,0))
> # now the second set
> n250<-bias.alpha2$nsample==250
> matplot(x=bias.alpha2$lambda[n250],y=bias.alpha2[n250,3:5],
> type="l",pch=1:3,col=c(4,2,3),ylim=c(-.1,
.6),ylab="")
> abline(h = 0, col = "gray60")
> mtext(expression(paste("Bias av. for ",alpha[2])),side=2,line=2,
cex.main=1.5)
>
> screen(6)
> par(mar=c(3,0,0,0))
> # now the second set
> n1000<-bias.alpha2$nsample==1000
> matplot(x=bias.alpha2$lambda[n1000],y=bias.alpha2[n1000,3:5],
>
type="l",pch=1:3,col=c(4,2,3),yaxt="n",ylim=c(-.1, .6))
> abline(h = 0, col = "gray60")
>
>
>
>
> screen(7)
> par(mar=c(0,3.5,3,0))
> # now the second set
> n250<-SE.alpha1$nsample==250
> matplot(x=SE.alpha1$lambda[n250],y=SE.alpha1[n250,3:5],
>
type="l",pch=1:3,col=c(4,2,3),xaxt="n",ylim=c(0,
1.1),main="nsample=250",ylab="", cex.main=1)
> abline(h = -1, col = "gray60")
> mtext(expression(paste("SE av. for ",alpha[1])),side=2,line=2,
cex.main=1)
> mtext(expression(paste(lambda)),side=1,line=2, cex.main=1.5)
>
>
> screen(8)
> par(mar=c(0,0,3,0))
> # now the second set
> n1000<-SE.alpha1$nsample==1000
> matplot(x=SE.alpha1$lambda[n1000],y=SE.alpha1[n1000,3:5],
>
type="l",pch=1:3,col=c(4,2,3),xaxt="n",yaxt="n",ylim=c(0,
1.1),main="nsample=1000",ylab="")
> abline(h = -1, col = "gray60")
>
>
>
>
> screen(9)
> par(mar=c(3,3.5,0,0))
> # now the second set
> n250<-SE.alpha2$nsample==250
> matplot(x=SE.alpha2$lambda[n250],y=SE.alpha2[n250,3:5],
> type="l",pch=1:3,col=c(4,2,3),ylim=c(0,
1.1),ylab="")
> abline(h = -.5, col = "gray60")
> mtext(expression(paste("SE av. for ",alpha[2])),side=2,line=2,
cex.main=1.5)
> mtext(expression(paste(lambda)),side=1,line=2, cex.main=1.5)
>
>
> screen(10)
> par(mar=c(3,0,0,0))
> # now the second set
> n1000<-SE.alpha2$nsample==1000
> matplot(x=SE.alpha2$lambda[n1000],y=SE.alpha2[n1000,3:5],
>
type="l",pch=1:3,col=c(4,2,3),yaxt="n",ylim=c(0, 1.1))
> abline(h = -.5, col = "gray60")
> mtext(expression(paste(lambda)),side=1,line=2, , cex.main=1.5)
>
>
>
> screen(2)
> par(mar=c(0,0,0,0))
> # plot an empty plot to get the coordinates
> plot(0:1,0:1,type="n",axes=FALSE)
> legend(0,0.6,c("OLS", "GLS", "Reg. Cal.",
"0"),bty = "n",
lty=1:3,col=c(4,2,3,"gray60"),xpd=TRUE)
>
>
> close.screen(all=TRUE)
>
>
> and I attach the output graph.
>
>
>
> Best,
> RO
>
> Atenciosamente,
> Rosa Oliveira
>
> _________________________________
>
>
> Antes de imprimir este e-mail pense bem se tem mesmo que o fazer.
> H? cada vez menos ?rvores.
> N?o imprima, pense na sua responsabilidade e compromisso com o MEIO
AMBIENTE!
>
<http://pt.dreamstime.com/cora-ccedil-atildeo-criado-das-folhas-de-aacutervores-diferentes-thumb12275776.jpg>
>
<http://pt.dreamstime.com/cora-ccedil-atildeo-criado-das-folhas-de-aacutervores-diferentes-thumb12275776.jpg>
>
> 2015-09-17 12:18 GMT+01:00 Jim Lemon <drjimlemon at gmail.com
<mailto:drjimlemon at gmail.com>>:
> Hi Rosa,
> Try this:
>
> # do the first split, to get the rightmost screen for the legend
> split.screen(figs=matrix(c(0,0.84,0,1,0.84,1,0,1),nrow=2,byrow=TRUE))
> # now split the first screen to get your eight screens (numbered 3 to 10)
for the plots
> split.screen(figs=matrix(c(0,0.25,0.5,1,
> 0.25,0.5,0.5,1,
> 0.5,0.75,0.5,1,
> 0.75,1,0.5,1,
> 0,0.25,0,0.5,
> 0.25,0.5,0,0.5,
> 0.5,0.75,0,0.5,
> 0.75,1,0,0.5),
> ncol=4,byrow=TRUE),screen=1)
>
> Jim
>
>
> On Thu, Sep 17, 2015 at 2:45 AM, Rosa Oliveira <rosita21 at gmail.com
<mailto:rosita21 at gmail.com>> wrote:
> Dear all,
>
> I?m trying to do a graph,
>
> 3 rows, 5 columns, with the design:
> # 3 4 5 6
> # 2
> # 7 8 9 10
>
> I had a code for 3 rows, 3 columns, with the design::
> # 3 4
> # 2
> # 7 8
> and I tried to modify it, but I had no success :(
>
> I suppose the problem is in the slip.screen code (red part of the code).
>
> I attach my code, can anyone please help me?
>
>
> Best,
> RO
>
>
> setwd("/Users/RO/Dropbox/LMER -
3rdproblem/R/latest_version/graphs/data")
>
> library(ggplot2)
> library(reshape)
> library(lattice)
>
>
> # read in what looks like half of the data
>
> bias.alpha2<-read.csv("graphs_bias_alpha2.csv")
> SE.alpha2<-read.csv("graphs_SE_alpha2.csv")
> bias.alpha1<-read.csv("graphs_bias_alpha1.csv")
> SE.alpha1<-read.csv("graphs_SE_alpha1.csv")
>
>
>
> quartz(width=10,height=6)
> # do the first split, to get the rightmost screen for the legend
> split.screen(figs=matrix(c(0,0.8,0,1,0.8,1,0,1),nrow=2,byrow=TRUE))
> # now split the first screen to get your six screens for the plots
>
>
>
> split.screen(figs=matrix(c(0,0.5,0.5,1,#primeira linha primeira coluna
> 0.5,1,0.5,1,#primeira linha segunda coluna
> 0,0.5,0,0.5,#segunda linha primeira coluna
> 0.5,1,0,0.5),#segunda linha segunda coluna
> ncol=4,byrow=TRUE),screen=1)
>
>
> # this produces seven screens numbered like this:
> # 3 4 5 6
> # 2
> # 7 8 9 10
> # select the upper left screen
>
>
>
> screen(3)
> par(mar=c(0,3.5,3,0))
> # now the second set
> n250<-bias.alpha1$nsample==250
> matplot(x=bias.alpha1$lambda[n250],y=bias.alpha1[n250,3:5],
>
type="l",pch=1:3,col=c(4,2,3),xaxt="n",ylim=c(-.1,
.6),main="nsample=250",ylab="", cex.main=1)
> abline(h = 0, col = "gray60")
> mtext(expression(paste("Bias av. for ",alpha[1])),side=2,line=2,
cex.main=1)
>
> screen(4)
> par(mar=c(0,0,3,0))
> # now the second set
> n1000<-bias.alpha1$nsample==1000
> matplot(x=bias.alpha1$lambda[n1000],y=bias.alpha1[n1000,3:5],
>
type="l",pch=1:3,col=c(4,2,3),xaxt="n",yaxt="n",ylim=c(-.1,
.6),main="nsample=1000",ylab="")
> abline(h = 0, col = "gray60")
>
>
>
> screen(5)
> par(mar=c(0,3.5,3,0))
> # now the second set
> par(mar=c(3,3.5,0,0))
> # now the second set
> n250<-bias.alpha2$nsample==250
> matplot(x=bias.alpha2$lambda[n250],y=bias.alpha2[n250,3:5],
> type="l",pch=1:3,col=c(4,2,3),ylim=c(-.1,
.6),ylab="")
> abline(h = 0, col = "gray60")
> mtext(expression(paste("Bias av. for ",alpha[2])),side=2,line=2,
cex.main=1.5)
>
> screen(6)
> par(mar=c(3,0,0,0))
> # now the second set
> n1000<-bias.alpha2$nsample==1000
> matplot(x=bias.alpha2$lambda[n1000],y=bias.alpha2[n1000,3:5],
>
type="l",pch=1:3,col=c(4,2,3),yaxt="n",ylim=c(-.1, .6))
> abline(h = 0, col = "gray60")
>
>
>
>
> screen(7)
> par(mar=c(0,3.5,3,0))
> # now the second set
> n250<-SE.alpha1$nsample==250
> matplot(x=SE.alpha1$lambda[n250],y=SE.alpha1[n250,3:5],
>
type="l",pch=1:3,col=c(4,2,3),xaxt="n",ylim=c(0,
1.1),main="nsample=250",ylab="", cex.main=1)
> abline(h = -1, col = "gray60")
> mtext(expression(paste("SE av. for ",alpha[1])),side=2,line=2,
cex.main=1)
> mtext(expression(paste(lambda)),side=1,line=2, cex.main=1.5)
>
>
> screen(8)
> par(mar=c(0,0,3,0))
> # now the second set
> n1000<-SE.alpha1$nsample==1000
> matplot(x=SE.alpha1$lambda[n1000],y=SE.alpha1[n1000,3:5],
>
type="l",pch=1:3,col=c(4,2,3),xaxt="n",yaxt="n",ylim=c(0,
1.1),main="nsample=1000",ylab="")
> abline(h = -1, col = "gray60")
>
>
>
>
> screen(9)
> par(mar=c(3,3.5,0,0))
> # now the second set
> n250<-SE.alpha2$nsample==250
> matplot(x=SE.alpha2$lambda[n250],y=SE.alpha2[n250,3:5],
> type="l",pch=1:3,col=c(4,2,3),ylim=c(0,
1.1),ylab="")
> abline(h = -.5, col = "gray60")
> mtext(expression(paste("SE av. for ",alpha[2])),side=2,line=2,
cex.main=1.5)
> mtext(expression(paste(lambda)),side=1,line=2, cex.main=1.5)
>
>
> screen(10)
> par(mar=c(3,0,0,0))
> # now the second set
> n1000<-SE.alpha2$nsample==1000
> matplot(x=SE.alpha2$lambda[n1000],y=SE.alpha2[n1000,3:5],
>
type="l",pch=1:3,col=c(4,2,3),yaxt="n",ylim=c(0, 1.1))
> abline(h = -.5, col = "gray60")
> mtext(expression(paste(lambda)),side=1,line=2, , cex.main=1.5)
>
>
>
> screen(2)
> par(mar=c(0,0,0,0))
> # plot an empty plot to get the coordinates
> plot(0:1,0:1,type="n",axes=FALSE)
> legend(0,0.6,c("OLS", "GLS", "Reg. Cal.",
"0"),bty = "n",
lty=1:3,col=c(4,2,3,"gray60"),xpd=TRUE)
>
>
> close.screen(all=TRUE)
>
>
>
>
> Best,
> RO
>
>
> Atenciosamente,
> Rosa Oliveira
>
> --
>
____________________________________________________________________________
>
>
> Rosa Celeste dos Santos Oliveira,
>
> E-mail: rosita21 at gmail.com <mailto:rosita21 at gmail.com>
> Tlm: +351 939355143 <tel:%2B351%20939355143>
> Linkedin: https://pt.linkedin.com/in/rosacsoliveira
<https://pt.linkedin.com/in/rosacsoliveira>
>
____________________________________________________________________________
> "Many admire, few know"
> Hippocrates
>
> ______________________________________________
> R-help at r-project.org <mailto:R-help at r-project.org> mailing list
-- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
<https://stat.ethz.ch/mailman/listinfo/r-help>
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
<http://www.r-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>
>
>
>
Hi Rosa,
I think I understand more or less what you want, but the example below uses
made up data as I do not have access to your files. The following code
should produce a block of eight plots with the y axes on the leftmost plots
only and the x axes on the bottom row only. I think I have what you wanted
for the titles. You can get a gap between the two rows of plots if you add
a 0.5 bottom margin to the top row and a 0.5 top margin to the bottom row.
All you have to do is use your data instead of the made up data. I used a
device with width=12 and height=5.
# do the first split, to get the rightmost screen for the legend
split.screen(figs=matrix(c(0,0.84,0,1,0.84,1,0,1),nrow=2,byrow=TRUE))
# now split the first screen to get your eight screens
# (numbered 3 to 10) for the plots
split.screen(figs=matrix(c(0,0.31,0.5,1,
0.31,0.54,0.5,1,
0.54,0.77,0.5,1,
0.77,1,0.5,1,
0,0.31,0,0.5,
0.31,0.54,0,0.5,
0.54,0.77,0,0.5,
0.77,1,0,0.5),
ncol=4,byrow=TRUE),screen=1)
# now make up some data so that I can try out the plot
lambda<-seq(0.7,0.95,by=0.05)
ols_bias_alpha1_250<-c(0.6,0.5,0.4,0.3,0.2,0.1)
ols_bias_alpha1_1000<-c(0.62,0.53,0.44,0.35,0.26,0.17)
gls_bias_alpha1_250<-c(-0.05,0,0.01,0.02,0,-0.01)
gls_bias_alpha1_1000<-c(0.09,0.08,0.07,0.05,0.04,0.045)
screen(3)
par(mar=c(0,4,3,0))
# plot bias for alpha1 250
matplot(lambda,matrix(c(ols_bias_alpha1_250,gls_bias_alpha1_250),ncol=2),
type="l",col=c(4,2),xaxt="n",ylim=c(-.1, .6),
ylab="", cex.main=1)
abline(h = 0, col = "gray60")
mtext("nsample=250",side=3,line=0.6)
mtext(expression(paste("Bias av. for ",alpha[1])),side=2,line=2,
cex.main=1)
screen(4)
par(mar=c(0,0,3,0))
# plot bias for alpha1 1000
matplot(lambda,matrix(c(ols_bias_alpha1_1000,gls_bias_alpha1_1000),ncol=2),
type="l",col=c(4,2),xaxt="n",yaxt="n",ylim=c(-.1,
.6),
ylab="", cex.main=1)
abline(h = 0, col = "gray60")
mtext("nsample=1000",side=3,line=0.6)
# now the centered title
par(xpd=TRUE)
mtext("alpha1",side=3,line=1.7,at=0.69)
par(xpd=FALSE)
# make up more data
ols_bias_alpha2_250<-c(-0.04,-0.05,-0.06,-0.05,-0.04,-0.03)
ols_bias_alpha2_1000<-c(-0.04,-0.05,-0.06,-0.05,-0.04,-0.035)
gls_bias_alpha2_250<-c(0.1,0.08,0.06,0.04,0.03,0.01)
gls_bias_alpha2_1000<-c(0.1,0.08,0.06,0.04,0.03,0.01)
screen(5)
par(mar=c(0,0,3,0))
# plot bias for alpha2 250
matplot(lambda,matrix(c(ols_bias_alpha2_250,gls_bias_alpha2_250),ncol=2),
type="l",col=c(4,2),xaxt="n",yaxt="n",ylim=c(-.1,
.6),
ylab="", cex.main=1)
abline(h = 0, col = "gray60")
mtext("nsample=250",side=3,line=0.6)
screen(6)
par(mar=c(0,0,3,0))
# plot bias for alpha2 1000
matplot(lambda,matrix(c(ols_bias_alpha2_1000,gls_bias_alpha2_1000),ncol=2),
type="l",col=c(4,2),xaxt="n",yaxt="n",ylim=c(-.1,
.6),
ylab="", cex.main=1)
abline(h = 0, col = "gray60")
mtext("nsample=1000",side=3,line=0.6)
# now the centered title
par(xpd=TRUE)
mtext("alpha2",side=3,line=1.7,at=0.69)
par(xpd=FALSE)
# more data!
ols_se_alpha1_250<-c(0.45,0.46,0.47,0.48,0.49,0.51)
gls_se_alpha1_250<-c(0.7,0.62,0.58,0.56,0.54,0.52)
ols_se_alpha1_1000<-c(0.2,0.21,0.22,0.23,0.24,0.251)
gls_se_alpha1_1000<-c(0.3,0.29,0.28,0.27,0.26,0.252)
screen(7)
par(mar=c(3,4,0,0))
# plot SE for alpha1 250
matplot(lambda,matrix(c(ols_se_alpha1_250,gls_se_alpha1_250),ncol=2),
type="l",col=c(4,2),ylim=c(0,1.1),
ylab="", cex.main=1)
mtext(expression(paste("SE av. for ",alpha[1])),side=2,line=2,
cex.main=1)
mtext(expression(paste(lambda)),side=1,line=2, cex.main=1.5)
screen(8)
par(mar=c(3,0,0,0))
# plot SE for alpha1 1000
matplot(lambda,matrix(c(ols_se_alpha1_1000,gls_se_alpha1_1000),ncol=2),
type="l",col=c(4,2),ylim=c(0,1.1),yaxt="n",
ylab="", cex.main=1)
mtext(expression(paste(lambda)),side=1,line=2, cex.main=1.5)
# even more data!
ols_se_alpha2_250<-c(0.12,0.13,0.14,0.16,0.18,0.2)
gls_se_alpha2_250<-c(0.3,0.26,0.24,0.22,0.21,0.2)
ols_se_alpha2_1000<-c(0.1,0.11,0.12,0.13,0.14,0.15)
gls_se_alpha2_1000<-c(0.2,0.19,0.18,0.17,0.16,0.15)
screen(9)
par(mar=c(3,0,0,0))
# plot SE for alpha1 250
matplot(lambda,matrix(c(ols_se_alpha2_250,gls_se_alpha2_250),ncol=2),
type="l",col=c(4,2),ylim=c(0,1.1),
yaxt="n",ylab="", cex.main=1)
mtext(expression(paste(lambda)),side=1,line=2, cex.main=1.5)
screen(10)
par(mar=c(3,0,0,0))
# plot SE for alpha1 1000
matplot(lambda,matrix(c(ols_se_alpha2_1000,gls_se_alpha2_1000),ncol=2),
type="l",col=c(4,2),ylim=c(0,1.1),yaxt="n",
ylab="", cex.main=1)
mtext(expression(paste(lambda)),side=1,line=2, cex.main=1.5)
# finally the legend
screen(2)
par(mar=c(0,0,0,0))
# plot an empty plot to get the coordinates
plot(0:1,0:1,type="n",axes=FALSE)
legend(0,0.6,c("OLS", "GLS", "Reg. Cal.",
"0"),bty = "n",
lty=1:3,col=c(4,2,3,"gray60"),xpd=TRUE)
close.screen(all=TRUE)
Jim
On Mon, Sep 21, 2015 at 2:14 AM, Rosa Oliveira <rosita21 at gmail.com>
wrote:
> Dear Jim,
>
>
> I?ve tried till today, but I could not solve the problems.
>
> 1. despite the scales are the same (equal: lambda ={0.70, 0.75, 0.80,
> 0.85, 0.90, 0.95, 0.98}), the "matrix" is not equal. If you see,
for n > 250 the column is narrower than for n = 1000, and "lambda"
has the same
> values.
>
> 2. the first 2 columns relate to alpha 1 and the second two columns
> alpha2. Is it possible to place a title above nsample that concerns the
> first 2 columns and other over the last 2?
>
> something like:
>
> *alpha1*
> *alpha2*
> nsample=250 nsample=1000 nsample=250
> nsample=1000
>
>
> 3. Notice that have 4 separate drawings and must place the 4
"groups"
> together.
> ...
>
[[alternative HTML version deleted]]