Re: [R] grid lines aligned on each ticks with a log scale

2010-03-20 Thread Benoit Boulinguiez
Terrific! How could I've missed that. Well, I know, I didn't get it from the
documentation...

Thanks


Regards/Cordialement


Benoit Boulinguiez 


-Message d'origine-
De : Duncan Murdoch [mailto:murd...@stats.uwo.ca] 
Envoyé : samedi 20 mars 2010 14:54
À : Benoit Boulinguiez
Cc : r-help@r-project.org
Objet : Re: [R] grid lines aligned on each ticks with a log scale

On 20/03/2010 7:35 AM, Duncan Murdoch wrote:
> On 20/03/2010 6:38 AM, Benoit Boulinguiez wrote:
>> Hi all,
>>  
>> for publication purpose I must provide a graph with grid lines 
>> aligned with each tick mark.
>> Thing is that the graph has a log scale on the x-axis.
>> I looked at the grid() and par() documentation but still don't figure 
>> out how to get it done.
>>  
>>  
>> simple example
>>  
>> plot(seq(1,9), log="x", panel.first=grid())
>>  
>> how to get lines at x = 2 and 5 on the graph?
> 
> Use abline instead of grid for fine tuning:
> 
> plot(seq(1,9), log="x", panel.first=abline(v=c(1,2,5),h=c(2,4,6,8),
> lty=3,col="gray"))

or more simply, just use equilogs=FALSE in the grid call:

plot(seq(1,9), log="x", panel.first=grid(equilogs=FALSE))

Duncan Murdoch

> 
> Duncan Murdoch
> 
>> Of course the option "nx" in grid() is not valid, as it does not 
>> align the grid lines with the ticks in a log scale...
>>  
>> Thanks for giving a hand.
>>
>> Regards/Cordialement
>>
>> -
>> Benoit Boulinguiez
>> Ph.D student
>> Ecole de Chimie de Rennes (ENSCR) Bureau 1.20 Equipe CIP UMR CNRS 
>> 6226 "Sciences Chimiques de Rennes"
>> Avenue du Général Leclerc
>> CS 50837
>> 35708 Rennes CEDEX 7
>> Tel 33 (0)2 23 23 80 83
>> Fax 33 (0)2 23 23 81 20
>>  <http://www.ensc-rennes.fr/> http://www.ensc-rennes.fr/
>>
>>  
>>
>>  [[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-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-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] grid lines aligned on each ticks with a log scale

2010-03-20 Thread Duncan Murdoch

On 20/03/2010 7:35 AM, Duncan Murdoch wrote:

On 20/03/2010 6:38 AM, Benoit Boulinguiez wrote:

Hi all,
 
for publication purpose I must provide a graph with grid lines aligned with

each tick mark.
Thing is that the graph has a log scale on the x-axis.
I looked at the grid() and par() documentation but still don't figure out
how to get it done.
 
 
simple example
 
plot(seq(1,9), log="x", panel.first=grid())
 
how to get lines at x = 2 and 5 on the graph?


Use abline instead of grid for fine tuning:

plot(seq(1,9), log="x", panel.first=abline(v=c(1,2,5),h=c(2,4,6,8), 
lty=3,col="gray"))


or more simply, just use equilogs=FALSE in the grid call:

plot(seq(1,9), log="x", panel.first=grid(equilogs=FALSE))

Duncan Murdoch



Duncan Murdoch


Of course the option "nx" in grid() is not valid, as it does not align the
grid lines with the ticks in a log scale...
 
Thanks for giving a hand.


Regards/Cordialement

-
Benoit Boulinguiez
Ph.D student
Ecole de Chimie de Rennes (ENSCR) Bureau 1.20 
Equipe CIP UMR CNRS 6226 "Sciences Chimiques de Rennes"
Avenue du Général Leclerc 
CS 50837 
35708 Rennes CEDEX 7 
Tel 33 (0)2 23 23 80 83

Fax 33 (0)2 23 23 81 20
  http://www.ensc-rennes.fr/ 

 


[[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-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-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] grid lines aligned on each ticks with a log scale

2010-03-20 Thread Duncan Murdoch

On 20/03/2010 6:38 AM, Benoit Boulinguiez wrote:

Hi all,
 
for publication purpose I must provide a graph with grid lines aligned with

each tick mark.
Thing is that the graph has a log scale on the x-axis.
I looked at the grid() and par() documentation but still don't figure out
how to get it done.
 
 
simple example
 
plot(seq(1,9), log="x", panel.first=grid())
 
how to get lines at x = 2 and 5 on the graph?


Use abline instead of grid for fine tuning:

plot(seq(1,9), log="x", panel.first=abline(v=c(1,2,5),h=c(2,4,6,8), 
lty=3,col="gray"))


Duncan Murdoch


Of course the option "nx" in grid() is not valid, as it does not align the
grid lines with the ticks in a log scale...
 
Thanks for giving a hand.


Regards/Cordialement

-
Benoit Boulinguiez
Ph.D student
Ecole de Chimie de Rennes (ENSCR) Bureau 1.20 
Equipe CIP UMR CNRS 6226 "Sciences Chimiques de Rennes"
Avenue du Général Leclerc 
CS 50837 
35708 Rennes CEDEX 7 
Tel 33 (0)2 23 23 80 83

Fax 33 (0)2 23 23 81 20
  http://www.ensc-rennes.fr/ 

 


[[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-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] grid lines aligned on each ticks with a log scale

2010-03-20 Thread Benoit Boulinguiez
Hi all,
 
for publication purpose I must provide a graph with grid lines aligned with
each tick mark.
Thing is that the graph has a log scale on the x-axis.
I looked at the grid() and par() documentation but still don't figure out
how to get it done.
 
 
simple example
 
plot(seq(1,9), log="x", panel.first=grid())
 
how to get lines at x = 2 and 5 on the graph?
Of course the option "nx" in grid() is not valid, as it does not align the
grid lines with the ticks in a log scale...
 
Thanks for giving a hand.

Regards/Cordialement

-
Benoit Boulinguiez
Ph.D student
Ecole de Chimie de Rennes (ENSCR) Bureau 1.20 
Equipe CIP UMR CNRS 6226 "Sciences Chimiques de Rennes"
Avenue du Général Leclerc 
CS 50837 
35708 Rennes CEDEX 7 
Tel 33 (0)2 23 23 80 83
Fax 33 (0)2 23 23 81 20
  http://www.ensc-rennes.fr/ 

 

[[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] Grid lines in cloud plot for lattice

2009-08-26 Thread Chris Jones
Hi all,

I was wondering if there was a way to draw out grid lines in the cloud  
plots for lattice. I hunted all throughout the panel.cloud and panel. 
3dscatter help pages and couldn't find anything to help me move  
forward with this. Do I have to get deeper into the drawing commands,  
or is there something more obvious I'm just not seeing? My goal would  
be to place grid lines on the bottom face of the box and make drop  
lines to the grid.


#example dat set
nirK.env.nmds$points = cbind(rnorm(30),rnorm(30),rnorm(30))

par.set <-
 list(axis.line = list(col = "transparent"),clip = list(panel =  
"off"))

print(cloud(nirk.env.nmds$points[,3]~nirk.env.nmds$points[, 
1]*nirk.env.nmds$points[,2],
 col="red",pch=16,cex=1.5,type=c("p","h"),
 strip = strip.custom(strip.names = TRUE),
 scales=list(arrows=FALSE,distance=2),
 xlab="NMS 1",
 ylab="NMS 2",
 zlab="NMS 3"),
 par.settings=par.set,
 split = c(1,1,2,1), more=TRUE)

Many thanks!!

Chris Jones
Ph. D. Student, Department of Microbiology
Swedish University of Agricultural Sciences
chris.jo...@mikrob.slu.se




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


Re: [R] Grid lines

2009-07-30 Thread Uwe Ligges



Chris Li wrote:

Thanks for the reply guys. Below are the script and data files.

http://www.nabble.com/file/p24734049/HEAD_calibration.R HEAD_calibration.R 
http://www.nabble.com/file/p24734049/6527-1052 6527-1052 
http://www.nabble.com/file/p24734049/6527-1054 6527-1054 
http://www.nabble.com/file/p24734049/MAR3 MAR3 


Once again, thank you for your help, greatly appreciated!!

Chris


Chris Li wrote:

Hi everyone. I am new to R.

It will be greatly appreciated if someone can help me with the following
questions.

Here's the graph I have just produced. 
http://www.nabble.com/file/p24732839/calibration.jpeg 


(1) How can I put the legend on top of the grid lines?

(2) How can I match the grid lines with the x-axis ticks?

(3) How can I change the x-axis format from e.g. Mar, Apr...etc to
1-3-2009,1-4-2009...etc?

Many thanks! :-)

Chris






Example for your loop:

for (i in c(1:n)){
file.name=f[i]
dat<-read.csv(file.name,header=F)
colnames(dat)<-c("obsTime","obsHead","comTime","comHead")
obsTime<-as.Date(dat$obsTime,origin=model.startdate)
comTime<-as.Date(dat$comTime,origin=model.startdate)

### omit x axis at first:
plot(obsTime,dat$obsHead,main=file.name,xlab="Date",ylab="Hydraulic 
Head (mAHD)",col="blue",ylim=c(ymin,ymax), xaxt="n")


### add x axis with given format and save the locations:first:
xticks <- axis.Date(1, obsTime, format = "%d-%m-%Y")
lines(comTime,dat$comHead,col="red")

### add you self designed grid:
abline(v=xticks, h=axTicks(2), lty=1, col="darkgray")

### legend with white background at the end:
legend("bottomright",legend=c("Observed Head","Computed 
Head"),col=c("blue","red"),lty=c(0,1),pch=c(1,-1), bg="white")



### forget about:
#grid(lty=1,col="darkgray")
}



Uwe Ligges

__
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] Grid lines

2009-07-30 Thread Chris Li

Thanks for the reply guys. Below are the script and data files.

http://www.nabble.com/file/p24734049/HEAD_calibration.R HEAD_calibration.R 
http://www.nabble.com/file/p24734049/6527-1052 6527-1052 
http://www.nabble.com/file/p24734049/6527-1054 6527-1054 
http://www.nabble.com/file/p24734049/MAR3 MAR3 

Once again, thank you for your help, greatly appreciated!!

Chris


Chris Li wrote:
> 
> Hi everyone. I am new to R.
> 
> It will be greatly appreciated if someone can help me with the following
> questions.
> 
> Here's the graph I have just produced. 
> http://www.nabble.com/file/p24732839/calibration.jpeg 
> 
> (1) How can I put the legend on top of the grid lines?
> 
> (2) How can I match the grid lines with the x-axis ticks?
> 
> (3) How can I change the x-axis format from e.g. Mar, Apr...etc to
> 1-3-2009,1-4-2009...etc?
> 
> Many thanks! :-)
> 
> Chris
> 

-- 
View this message in context: 
http://www.nabble.com/Grid-lines-tp24732839p24734049.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Grid lines

2009-07-30 Thread Thomas Roth (geb. Kaliwe)

Maybe this helps


par(mar = c(5,4,6,1))
plot(1:10, type = "n", axes = F)
xticks = axis(1, at = c(1,5,9), labels =
c("1-1-2009","1-5-2009","1-9-2009"))   #set axis manually
yticks = axis(2, at = 1:10)   #set axis manually
abline(v = xticks, col = "gray")   #verticall lines
abline(h = yticks, col = "gray", lty = 3)   #horizontal lines

legend(8,12, legend = c("test", "test"), col = 1:2, pch = 1:2, xpd = TRUE)

points(1:10)


Thomas Roth

Chris Li schrieb:

Hi everyone. I am new to R.

It will be greatly appreciated if someone can help me with the following
questions.

Here's the graph I have just produced. 
http://www.nabble.com/file/p24732839/calibration.jpeg 


(1) How can I put the legend on top of the grid lines?

(2) How can I match the grid lines with the x-axis ticks?

(3) How can I change the x-axis format from e.g. Mar, Apr...etc to
1-3-2009,1-4-2009...etc?

Many thanks! :-)

Chris



__
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] Grid lines

2009-07-30 Thread Thomas Roth (geb. Kaliwe)

Maybe this helps


par(mar = c(5,4,6,1))
plot(1:10, type = "n", axes = F)
xticks = axis(1, at = c(1,5,9), labels = 
c("1-1-2009","1-5-2009","1-9-2009"))   #set axis manually

yticks = axis(2, at = 1:10)   #set axis manually
abline(v = xticks, col = "gray")   #verticall lines
abline(h = yticks, col = "gray", lty = 3)   #horizontal lines

legend(8,12, legend = c("test", "test"), col = 1:2, pch = 1:2, xpd = TRUE)

points(1:10)


Thomas Roth

Chris Li schrieb:

Hi everyone. I am new to R.

It will be greatly appreciated if someone can help me with the following
questions.

Here's the graph I have just produced. 
http://www.nabble.com/file/p24732839/calibration.jpeg 


(1) How can I put the legend on top of the grid lines?

(2) How can I match the grid lines with the x-axis ticks?

(3) How can I change the x-axis format from e.g. Mar, Apr...etc to
1-3-2009,1-4-2009...etc?

Many thanks! :-)

Chris



__
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] Grid lines

2009-07-30 Thread Uwe Ligges



Chris Li wrote:

Hi everyone. I am new to R.

It will be greatly appreciated if someone can help me with the following
questions.

Here's the graph I have just produced. 
http://www.nabble.com/file/p24732839/calibration.jpeg 


(1) How can I put the legend on top of the grid lines?



It probably is on top. I guess you want white background as in:

legend(., bg="white")



(2) How can I match the grid lines with the x-axis ticks?



grid() does exactly that for me, so I guess you are not using base 
graphics, hence please provide reproducible code as the posting guide 
suggests!




(3) How can I change the x-axis format from e.g. Mar, Apr...etc to
1-3-2009,1-4-2009...etc?



One way is to specify the x-axis separately, but since we do not know 
how you produced that plot 


Uwe Ligges





Many thanks! :-)

Chris


__
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] Grid lines

2009-07-30 Thread Patrick Connolly
On Wed, 29-Jul-2009 at 11:32PM -0700, Chris Li wrote:

|> 
|> Hi everyone. I am new to R.
|> 
|> It will be greatly appreciated if someone can help me with the following
|> questions.
|> 
|> Here's the graph I have just produced. 
|> http://www.nabble.com/file/p24732839/calibration.jpeg 
|> 
|> (1) How can I put the legend on top of the grid lines?
|> 
|> (2) How can I match the grid lines with the x-axis ticks?
|> 
|> (3) How can I change the x-axis format from e.g. Mar, Apr...etc to
|> 1-3-2009,1-4-2009...etc?

You've obviously done some tinkering with the plot function, but I
don't know which of the dozens of possible ways you used to do that,
so I can't tell what adjustments are needed.  There are some people on
this list who are good at guessing, but it would make it easier for
you if you told us.  The operative phrase is 'reproducible code' and
there's a few more of them in the footer of every message from this
list.

HTH

-- 
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.   
   ___Patrick Connolly   
 {~._.~}   Great minds discuss ideas
 _( Y )_ Average minds discuss events 
(:_~*~_:)  Small minds discuss people  
 (_)-(_)  . Eleanor Roosevelt
  
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.

__
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] Grid lines

2009-07-29 Thread Chris Li

Hi everyone. I am new to R.

It will be greatly appreciated if someone can help me with the following
questions.

Here's the graph I have just produced. 
http://www.nabble.com/file/p24732839/calibration.jpeg 

(1) How can I put the legend on top of the grid lines?

(2) How can I match the grid lines with the x-axis ticks?

(3) How can I change the x-axis format from e.g. Mar, Apr...etc to
1-3-2009,1-4-2009...etc?

Many thanks! :-)

Chris
-- 
View this message in context: 
http://www.nabble.com/Grid-lines-tp24732839p24732839.html
Sent from the R help mailing list archive at Nabble.com.

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