Re: [R] Second axis on bottom of graph

2014-05-28 Thread Hurr
Thank you Frede Aakmann Tøgersen-2 for your criticism.
Yes the data is only similar to the data it is being made for. 
Our Lab been looking for years for a good way to 
make our graphs without buying expensive software.
We have used mostly MS Excel, but the two axes are difficult.
Good graphing software is hard to find. 
Yes it is my "own hard minded way to have my 
plot made the way I like it". But it is also the 
way that my supervisor likes to show the data. 
Even though the graph scale is frequency, 
we think in terms of period.
Sorry I need someone to teach me.
Have I satisfied a little of your curiosity?
Hurr




--
View this message in context: 
http://r.789695.n4.nabble.com/Second-axis-on-bottom-of-graph-tp4690696p4691398.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] Second axis on bottom of graph

2014-05-28 Thread Frede Aakmann Tøgersen
Hi Hurr

I'm getting curious!

You have now spent several weeks on this plot. One reason to do this if the 
journal request it. Is that the case?

Or is it your own hard minded way to have your plot made the way you like.

In my mind a very good plot support ones data.  Is that what you want? Does it 
then matters with details?

Br.

Frede


Sendt fra Samsung mobil


 Oprindelig meddelelse 
Fra: Hurr
Dato:28/05/2014 19.03 (GMT+01:00)
Til: r-help@r-project.org
Emne: Re: [R] Second axis on bottom of graph

Thank you Jeff for your good orientation. You are an educator.
I looked at the documentation for more than an hour.
Yes, there is a big learning curve.
My R-coding friend doesn't know it either.
Here is runnable code for a graph I would like to redo in the better code.
The staxlab function was sent to me by the author.
The remainder code isn't so long.
An expert could rewrite it quickly. Any out there?

#trying for both period-labeled and frequency-labeled horizontal axes
rm(list=ls(all=TRUE))
install.packages('plotrix'); library(plotrix)
#install.packages('lattice'); library(lattice)
#install.packages('ggplot2'); library(ggplot2)
#staxlab (to be standard soon) sent by author so staxlab works on second x
axis.
staxlab<-function(side=1,at,labels,nlines=2,top.line=0.5,
 line.spacing=0.8,srt=NA,ticklen=0.03,adj=1,...) {
 if(missing(labels)) labels<-at
 nlabels<-length(labels)
 if(missing(at)) at<-1:nlabels
 axislim<-par("usr")[3:4-2*side%%2]
 if(any(at < axislim[1]) || any(at > axislim[2]))
  warning("Some axis labels are off the plot")
 if(is.na(srt)) {
  linepos<-rep(top.line,nlines)
  for(i in 2:nlines) linepos[i]<-linepos[i-1]+line.spacing
  linepos<-rep(linepos,ceiling(nlabels/nlines))[1:nlabels]
  axis(side=side,at=at,labels=rep("",nlabels))
  mtext(text=labels,side=side,line=linepos,at=at,...)
 }
 else {
  linewidth<-strheight("M")
  xylim<-par("usr")
  if(side == 1) {
   xpos<-at
   if(par("ylog")) ypos<-10^(xylim[3]-ticklen*(xylim[4]-xylim[3]))
   else ypos<-xylim[3]-ticklen*(xylim[4]-xylim[3])-top.line*linewidth
  }
  if(side == 3) {
   xpos<-at
   if(par("ylog")) ypos<-10^(xylim[4]+ticklen*(xylim[4]-xylim[3]))
   else ypos<-xylim[4]+ticklen*(xylim[4]-xylim[3])+top.line*linewidth
  }
  if(side == 2) {
   ypos<-at
   if(par("xlog")) xpos<-10^(xylim[1]-ticklen*(xylim[2]-xylim[1]))
   else xpos<-xylim[1]-ticklen*(xylim[2]-xylim[1])-top.line*linewidth
  }
  if(side == 4) {
   ypos<-at
   if(par("xlog")) xpos<-10^(xylim[2]+ticklen*(xylim[2]-xylim[1]))
   else xpos<-xylim[2]+ticklen*(xylim[2]-xylim[1])+top.line*linewidth
  }
  par(xpd=TRUE)
  text(xpos,ypos,labels,srt=srt,adj=adj,...)
  par(xpd=FALSE)
 }
}
par(lheight=0.7)#vertical text space = lheight * char height * character
expansion
par(mar=c(8,4,4,2)+.1)  #margins: mar=c(bot,lef,top,rit);
default:c(5,4,4,2)+.1
par(xaxs="i") #to make 2nd axis and plot width size match; others: xaxs=
"r", "i", "e", "s", "d".
par(mgp=c(3,.5,0)) #default mgp=c(3,1,0) margin line in mex units
c(axisTitle,axisLabel,axisLine)
#set only by
par():ask,fig,fin,lheight,mai,mar,mex,mfcol,mfrow,mfg,new,oma,omd,omi,pin,plt,ps,pty,usr,xlog,ylog,ylbias
prdAxDistDown=0; frqAxDistDown=2.25;

horAxFrqCntrlNums=c(-10.0,0.0,1.1,500.0,515.0)
#=c(lefGrafBordFrq,lefScalEndFrq,lefPlotEndFrq,ritPlotEndFrq,ritScalEndFrq)
horData=c(1.100,56.53,112.0,167.4,222.8,278.3,333.7,389.1,444.6,500.0)
verData=c(57.67,98.33,82.40,68.15,78.89,93.53,22.54,37.60,87.19,49.35)
prdTicLocs=c(1.10,12,52.2,91.3, 122, 183, 365,500)
prdLabels=c("10.9\nMo","1Mo","1Wk","4Da","3Da","2Da","1Da","17.5\nHr")

print(horAxFrqCntrlNums); print(prdLabels)
nFrqTicInvls=9; frqTicLocs <- vector(length=nFrqTicInvls+1); frqLabels <-
vector(length=nFrqTicInvls+1);
frqInvl=(horAxFrqCntrlNums[5]-horAxFrqCntrlNums[2])/nFrqTicInvls
for(i in
1:(nFrqTicInvls+1))frqTicLocs[i]=horAxFrqCntrlNums[2]+(i-1)*frqInvl;
for(i in
1:(nFrqTicInvls+1))frqLabels[i]=format(round(frqTicLocs[i]),digits=4,trim=TRUE,scientific=FALSE)
print(frqTicLocs); print(frqLabels)
las=2; #las=2 makes axis labels perpendicular to axis
plot(horData,verData,xaxt='n',xlim=c(horAxFrqCntrlNums[1],horAxFrqCntrlNums[5]),xlab="",ylab="")
axis(2,tick=TRUE,line=0,at=NULL) #side: 1=below, 2=left, 3=above and 4=right
#tck if >= 0.5 then fraction of relevant side; if =1 then gridlines
axis(1,tick=TRUE,line=prdAxDistDown,at=prdTicLocs,labels=rep("",length(prdLabels)),padj=0,tck=-.04)
staxlab(1,top.line=(prdAxDistDown-0.8),at=prdTicLocs,labels=prdLabels,srt=90,adj=c(1,0))
axis(1,tick=TRUE,line=frqAxDistDown,at=frqTicLocs,labels=rep("",length(frqLa

Re: [R] Second axis on bottom of graph

2014-05-28 Thread Hurr
Thank you Jeff for your good orientation. You are an educator.
I looked at the documentation for more than an hour.
Yes, there is a big learning curve. 
My R-coding friend doesn't know it either.
Here is runnable code for a graph I would like to redo in the better code.
The staxlab function was sent to me by the author.
The remainder code isn't so long.
An expert could rewrite it quickly. Any out there?

#trying for both period-labeled and frequency-labeled horizontal axes 
rm(list=ls(all=TRUE))
install.packages('plotrix'); library(plotrix) 
#install.packages('lattice'); library(lattice) 
#install.packages('ggplot2'); library(ggplot2) 
#staxlab (to be standard soon) sent by author so staxlab works on second x
axis.
staxlab<-function(side=1,at,labels,nlines=2,top.line=0.5,
 line.spacing=0.8,srt=NA,ticklen=0.03,adj=1,...) {
 if(missing(labels)) labels<-at
 nlabels<-length(labels)
 if(missing(at)) at<-1:nlabels
 axislim<-par("usr")[3:4-2*side%%2]
 if(any(at < axislim[1]) || any(at > axislim[2]))
  warning("Some axis labels are off the plot")
 if(is.na(srt)) {
  linepos<-rep(top.line,nlines)
  for(i in 2:nlines) linepos[i]<-linepos[i-1]+line.spacing
  linepos<-rep(linepos,ceiling(nlabels/nlines))[1:nlabels]
  axis(side=side,at=at,labels=rep("",nlabels))
  mtext(text=labels,side=side,line=linepos,at=at,...)
 }
 else {
  linewidth<-strheight("M")
  xylim<-par("usr")
  if(side == 1) {
   xpos<-at
   if(par("ylog")) ypos<-10^(xylim[3]-ticklen*(xylim[4]-xylim[3]))
   else ypos<-xylim[3]-ticklen*(xylim[4]-xylim[3])-top.line*linewidth
  }
  if(side == 3) {
   xpos<-at
   if(par("ylog")) ypos<-10^(xylim[4]+ticklen*(xylim[4]-xylim[3]))
   else ypos<-xylim[4]+ticklen*(xylim[4]-xylim[3])+top.line*linewidth
  }
  if(side == 2) {
   ypos<-at
   if(par("xlog")) xpos<-10^(xylim[1]-ticklen*(xylim[2]-xylim[1]))
   else xpos<-xylim[1]-ticklen*(xylim[2]-xylim[1])-top.line*linewidth
  }
  if(side == 4) {
   ypos<-at
   if(par("xlog")) xpos<-10^(xylim[2]+ticklen*(xylim[2]-xylim[1]))
   else xpos<-xylim[2]+ticklen*(xylim[2]-xylim[1])+top.line*linewidth
  }
  par(xpd=TRUE)
  text(xpos,ypos,labels,srt=srt,adj=adj,...)
  par(xpd=FALSE)
 }
}
par(lheight=0.7)#vertical text space = lheight * char height * character
expansion 
par(mar=c(8,4,4,2)+.1)  #margins: mar=c(bot,lef,top,rit);
default:c(5,4,4,2)+.1 
par(xaxs="i") #to make 2nd axis and plot width size match; others: xaxs=
"r", "i", "e", "s", "d". 
par(mgp=c(3,.5,0)) #default mgp=c(3,1,0) margin line in mex units
c(axisTitle,axisLabel,axisLine) 
#set only by
par():ask,fig,fin,lheight,mai,mar,mex,mfcol,mfrow,mfg,new,oma,omd,omi,pin,plt,ps,pty,usr,xlog,ylog,ylbias
 
prdAxDistDown=0; frqAxDistDown=2.25; 

horAxFrqCntrlNums=c(-10.0,0.0,1.1,500.0,515.0)
#=c(lefGrafBordFrq,lefScalEndFrq,lefPlotEndFrq,ritPlotEndFrq,ritScalEndFrq)
horData=c(1.100,56.53,112.0,167.4,222.8,278.3,333.7,389.1,444.6,500.0)
verData=c(57.67,98.33,82.40,68.15,78.89,93.53,22.54,37.60,87.19,49.35)
prdTicLocs=c(1.10,12,52.2,91.3, 122, 183, 365,500)
prdLabels=c("10.9\nMo","1Mo","1Wk","4Da","3Da","2Da","1Da","17.5\nHr")

print(horAxFrqCntrlNums); print(prdLabels) 
nFrqTicInvls=9; frqTicLocs <- vector(length=nFrqTicInvls+1); frqLabels <-
vector(length=nFrqTicInvls+1); 
frqInvl=(horAxFrqCntrlNums[5]-horAxFrqCntrlNums[2])/nFrqTicInvls 
for(i in
1:(nFrqTicInvls+1))frqTicLocs[i]=horAxFrqCntrlNums[2]+(i-1)*frqInvl; 
for(i in
1:(nFrqTicInvls+1))frqLabels[i]=format(round(frqTicLocs[i]),digits=4,trim=TRUE,scientific=FALSE)
 
print(frqTicLocs); print(frqLabels) 
las=2; #las=2 makes axis labels perpendicular to axis 
plot(horData,verData,xaxt='n',xlim=c(horAxFrqCntrlNums[1],horAxFrqCntrlNums[5]),xlab="",ylab="")
 
axis(2,tick=TRUE,line=0,at=NULL) #side: 1=below, 2=left, 3=above and 4=right 
#tck if >= 0.5 then fraction of relevant side; if =1 then gridlines 
axis(1,tick=TRUE,line=prdAxDistDown,at=prdTicLocs,labels=rep("",length(prdLabels)),padj=0,tck=-.04)
 
staxlab(1,top.line=(prdAxDistDown-0.8),at=prdTicLocs,labels=prdLabels,srt=90,adj=c(1,0))
 
axis(1,tick=TRUE,line=frqAxDistDown,at=frqTicLocs,labels=rep("",length(frqLabels)),padj=0,tck=-.04)
 
staxlab(1,top.line=(frqAxDistDown+0.2),at=frqTicLocs,labels=frqLabels,srt=90,adj=c(1,0))
 
title(xlab="Cycles/Yr",line=4); title(ylab="verData",line=1.5); 
title(main="Trying Both Frequency And Period Axes") 




--
View this message in context: 
http://r.789695.n4.nabble.com/Second-axis-on-bottom-of-graph-tp4690696p4691377.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] Second axis on bottom of graph

2014-05-27 Thread Jeff Newmiller
Well, the short answer is "don't do that" (resize after the fact). Resize your 
graphic window first and then re-tune your annotations for that size.

The longer answer is that the lattice and ggplot2 packages were developed in 
part in response to the limitations of base graphics. They don't necessarily 
offer the kind of fine tuning you have been doing but they are generally 
resizeable and simpler to create as long as your graph type is supported. 
Unfortunately, each of them comes with a learning curve to get started, but 
they are available alternatives.
---
Jeff NewmillerThe .   .  Go Live...
DCN:Basics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

On May 27, 2014 10:17:03 AM PDT, Hurr  wrote:
>Thanks David,
>I try and I wish I could benefit.
>Sorry I'm too stupid to learn much the documentation.
>There is so much of it and its interrelations not
>easily determined and I can't figure out where to look.
>It's hard to understand, but I try.
>Hard for my friends too.
>Now I have a quite nice graphic plot, 
>and it prints as-is.
>But if I try to stretch it manually or press the 
>full-page button (Windows 7) it's ruined.
>Hurr
>
>
>
>--
>View this message in context:
>http://r.789695.n4.nabble.com/Second-axis-on-bottom-of-graph-tp4690696p4691311.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.

__
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] Second axis on bottom of graph

2014-05-27 Thread Hurr
Thanks David,
I try and I wish I could benefit.
Sorry I'm too stupid to learn much the documentation.
There is so much of it and its interrelations not
easily determined and I can't figure out where to look.
It's hard to understand, but I try.
Hard for my friends too.
Now I have a quite nice graphic plot, 
and it prints as-is.
But if I try to stretch it manually or press the 
full-page button (Windows 7) it's ruined.
Hurr



--
View this message in context: 
http://r.789695.n4.nabble.com/Second-axis-on-bottom-of-graph-tp4690696p4691311.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] Second axis on bottom of graph

2014-05-26 Thread David Winsemius

On May 24, 2014, at 7:47 PM, Hurr wrote:

> Thanks again Jim.
> I stuck xaxs="i" in the existing par() command and it worked as I wanted it.
> I haven't looked at the documentation yet, but that's next.

Generally a better approach would be to study the documentation   first.


> Hurr
> 
> 
> View this message in context: 
> http://r.789695.n4.nabble.com/Second-axis-on-bottom-of-graph-tp4690696p4691204.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.

David Winsemius
Alameda, CA, USA

__
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] Second axis on bottom of graph

2014-05-24 Thread Hurr
Thanks again Jim.
I stuck xaxs="i" in the existing par() command and it worked as I wanted it.
I haven't looked at the documentation yet, but that's next.
Hurr




--
View this message in context: 
http://r.789695.n4.nabble.com/Second-axis-on-bottom-of-graph-tp4690696p4691204.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] Second axis on bottom of graph

2014-05-24 Thread Jim Lemon
On Sat, 24 May 2014 02:41:16 PM Hurr wrote:
> Another wish is to make the left and right
> plot borders match the axis limits I
> have placed on the second axis using
> "xlim=" in plot().
> But the axis is shorter than the
> plot and I want them equal.
> How do I do that?
> Hurr
> 
Perhaps you are looking for:

par(xaxs="i")

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.


Re: [R] Second axis on bottom of graph

2014-05-24 Thread Hurr
Another wish is to make the left and right 
plot borders match the axis limits I 
have placed on the second axis using 
"xlim=" in plot().
But the axis is shorter than the 
plot and I want them equal.
How do I do that?
Hurr




--
View this message in context: 
http://r.789695.n4.nabble.com/Second-axis-on-bottom-of-graph-tp4690696p4691201.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] Second axis on bottom of graph

2014-05-22 Thread Jeff Newmiller
Sarah's perhaps-too-clever comments had nothing to do with R, and everything to 
do with the fact that Nabble misleadingly suggests to you that this mailing 
list is hosted at their website. Very few of the participants on this EMAIL 
LIST use Nabble, so we don't have any idea about the troubles you may be having 
or the web page buttons you write about, and your mention of these issues is 
OFF TOPIC. Please read the Posting Guide.
---
Jeff NewmillerThe .   .  Go Live...
DCN:Basics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

On May 22, 2014 3:31:02 AM PDT, Hurr  wrote:
>Sorry, I don't know enough about R to understand what you said. 
>But I don't think I need to understand it.
>And secondly, my reason for my stupid recent post about not finding a 
>recent post was that I didn't notice that there was a little "1  2" in 
>the lower right hand corner meaning that I had to select a second page.
>I think it is better to start a new thread when 
>that happens so others will see my post too.
>Hurr
>
>
>
>--
>View this message in context:
>http://r.789695.n4.nabble.com/Second-axis-on-bottom-of-graph-tp4690696p4691042.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.

__
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] Second axis on bottom of graph

2014-05-22 Thread Hurr
Sorry, I don't know enough about R to understand what you said. 
But I don't think I need to understand it.
And secondly, my reason for my stupid recent post about not finding a 
recent post was that I didn't notice that there was a little "1  2" in 
the lower right hand corner meaning that I had to select a second page.
I think it is better to start a new thread when 
that happens so others will see my post too.
Hurr



--
View this message in context: 
http://r.789695.n4.nabble.com/Second-axis-on-bottom-of-graph-tp4690696p4691042.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] Second axis on bottom of graph

2014-05-21 Thread Sarah Goslee
Well, yes, and also a user error.

On Wed, May 21, 2014 at 6:50 PM, Hurr  wrote:
> On the page listing all of the post topics and time last post it
> says that this topic has a post at 6:05 am today, but
> that post doesn't show up when I view this topic.
> There must be some kind of programming error.
> Hurr

> --
> View this message in context: 
> http://r.789695.n4.nabble.com/Second-axis-on-bottom-of-graph-tp4690696p4691012.html
> Sent from the R help mailing list archive at Nabble.com.

The programming error is in claiming that Nabble is the R-help list
mailing list archive.

The user error is expecting the R-help email list to know anything
about Nabble, and in relying on the Nabble interface instead of
actually joining the R-help email list. See the footer of this message
for information.

Sarah

-- 
Sarah Goslee
http://www.functionaldiversity.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] Second axis on bottom of graph

2014-05-21 Thread Hurr
On the page listing all of the post topics and time last post it
says that this topic has a post at 6:05 am today, but
that post doesn't show up when I view this topic.
There must be some kind of programming error.
Hurr




--
View this message in context: 
http://r.789695.n4.nabble.com/Second-axis-on-bottom-of-graph-tp4690696p4691012.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] Second axis on bottom of graph

2014-05-21 Thread Hurr
Next I want to move the x axis labels up towards the axis to 
make the gap smaller. The mgp= was suggested to me. 
The staxlab function to be standard soon was sent to me by 
the author to make staxlab work on the second x axis.
Runnable code to help demonstrate what I want to do:
Hurr

#trying for both period-labeled and frequency labeled horizontal axis 
rm(list=ls(all=TRUE))
install.packages('plotrix')
library(plotrix)
staxlab<-function(side=1,at,labels,nlines=2,top.line=0.5,
 line.spacing=0.8,srt=NA,ticklen=0.03,adj=1,...) {
 if(missing(labels)) labels<-at
 nlabels<-length(labels)
 if(missing(at)) at<-1:nlabels
 axislim<-par("usr")[3:4-2*side%%2]
 if(any(at < axislim[1]) || any(at > axislim[2]))
  warning("Some axis labels are off the plot")
 if(is.na(srt)) {
  linepos<-rep(top.line,nlines)
  for(i in 2:nlines) linepos[i]<-linepos[i-1]+line.spacing
  linepos<-rep(linepos,ceiling(nlabels/nlines))[1:nlabels]
  axis(side=side,at=at,labels=rep("",nlabels))
  mtext(text=labels,side=side,line=linepos,at=at,...)
 }
 else {
  linewidth<-strheight("M")
  xylim<-par("usr")
  if(side == 1) {
   xpos<-at
   if(par("ylog")) ypos<-10^(xylim[3]-ticklen*(xylim[4]-xylim[3]))
   else ypos<-xylim[3]-ticklen*(xylim[4]-xylim[3])-top.line*linewidth
  }
  if(side == 3) {
   xpos<-at
   if(par("ylog")) ypos<-10^(xylim[4]+ticklen*(xylim[4]-xylim[3]))
   else ypos<-xylim[4]+ticklen*(xylim[4]-xylim[3])+top.line*linewidth
  }
  if(side == 2) {
   ypos<-at
   if(par("xlog")) xpos<-10^(xylim[1]-ticklen*(xylim[2]-xylim[1]))
   else xpos<-xylim[1]-ticklen*(xylim[2]-xylim[1])-top.line*linewidth
  }
  if(side == 4) {
   ypos<-at
   if(par("xlog")) xpos<-10^(xylim[2]+ticklen*(xylim[2]-xylim[1]))
   else xpos<-xylim[2]+ticklen*(xylim[2]-xylim[1])+top.line*linewidth
  }
  par(xpd=TRUE)
  text(xpos,ypos,labels,srt=srt,adj=adj,...)
  par(xpd=FALSE)
 }
}
horAxisLims=c(0,7213); hAL1=horAxisLims[1]; print(hAL1);
print(horAxisLims[2]) 
verData=c(1,365,809,1252,1753,2191,2922,3409,3896,4383,4819,5255,5691,6128,6564,7000)
#not fussy 
horData=c(1,300,800,1200,1700,2100,2900,3400,3800,4300,4800,5200,5600,6100,6500,7000)
#not at tics 
horTicLocs=c(1,365.,1252,1461,1753,2191,2922,4383,7000)
horLabels=c("1Yr","1Da","7Hr","6Hr","5Hr","4Hr","3Hr","2Hr","1.25\nHr")
par(mar=c(8,4,4,2)+.1,lheight=0.7)  #c(bot,lef,top,rit);
default:c(5,4,4,2)+.1 
#default mgp=c(3,1,0) margin line in mex units
c(axisTitle,axisLabel,axisLine) 
#plot(0, mgp=c(3,2,0), las=2) 
plot(horData,verData,xaxt='n',xlim=horAxisLims,xlab="",mgp=c(3,5,0))
axis(1,tick=TRUE,at=horTicLocs,labels=rep("",length(horLabels)),padj=0,tck=-.1)
staxlab(1,at=horTicLocs,labels=horLabels,srt=90,adj=c(1,0)) 
nFrqTicInvls=9; frqTicLocs <- vector(length=nFrqTicInvls+1); frqLabels <-
vector(length=nFrqTicInvls+1); 
frqInvl=(horAxisLims[2]-horAxisLims[1])/nFrqTicInvls 
for(i in 1:(nFrqTicInvls+1))frqTicLocs[i]=horAxisLims[1]+(i-1)*frqInvl 
for(i in
1:(nFrqTicInvls+1))frqLabels[i]=format(frqTicLocs[i],digits=4,trim=TRUE,scientific=FALSE)
 
for(i in 1:(nFrqTicInvls+1))print(frqLabels[i]) 
#tck if >= 0.5 then fraction of relevant side; if =1 then gridlines 
axis(1,tick=TRUE,line=3.5,at=frqTicLocs,labels=rep("",length(frqLabels)),padj=0,tck=-.1)
 
staxlab(1,top.line=5,at=frqTicLocs,labels=frqLabels,srt=90,adj=c(1,0)) 
title(xlab="Cycles/Yr",line=6)




--
View this message in context: 
http://r.789695.n4.nabble.com/Second-axis-on-bottom-of-graph-tp4690696p4690962.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] Second axis on bottom of graph

2014-05-20 Thread peter dalgaard
Hm? Try

plot(0, mgp=c(3,2,0), las=2)


On 20 May 2014, at 19:41 , Hurr  wrote:

> I was able to put tck=-0.1 into either par() or 
> axis() and it made a tick difference I understood.
> As I understand it, default for mgp is c(3,1,0).
> When I put mgp=c(3,4,0) or mgp=c(3,7,0) into 
> either par() or axis() I see no difference.
> Hurr
> 
> 
> 
> 
> --
> View this message in context: 
> http://r.789695.n4.nabble.com/Second-axis-on-bottom-of-graph-tp4690696p4690912.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.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd@cbs.dk  Priv: pda...@gmail.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] Second axis on bottom of graph

2014-05-20 Thread Hurr
I was able to put tck=-0.1 into either par() or 
axis() and it made a tick difference I understood.
As I understand it, default for mgp is c(3,1,0).
When I put mgp=c(3,4,0) or mgp=c(3,7,0) into 
either par() or axis() I see no difference.
Hurr




--
View this message in context: 
http://r.789695.n4.nabble.com/Second-axis-on-bottom-of-graph-tp4690696p4690912.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] Second axis on bottom of graph

2014-05-20 Thread peter dalgaard

On 20 May 2014, at 16:34 , Hurr  wrote:

> I had asked How can I:
> 1) make ticks shorter or longer
> 2) make ticks cross the axis line
> 3) make ticks project toward the plot
> 4) make grid lines
> 5) make perpendicular labels be
>   close to the axis near ticks
>   projecting away from the plot 
> 
> I figured out that par(tck=..) solves three of the questions:
> 1) make ticks shorter or longer
> 3) make ticks project toward the plot
> 4) make grid lines
> But my how do I?
> 5) set the small distance I want the perdendicular 
> labels to be from the axis and from the ticks.
> 

2nd element of par(mgp=...), I think.


> Hurr
> 
> 
> 
> 
> --
> View this message in context: 
> http://r.789695.n4.nabble.com/Second-axis-on-bottom-of-graph-tp4690696p4690888.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.

-- 
Peter Dalgaard, Professor
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd@cbs.dk  Priv: pda...@gmail.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] Second axis on bottom of graph

2014-05-20 Thread Hurr
I had asked How can I:
1) make ticks shorter or longer
2) make ticks cross the axis line
3) make ticks project toward the plot
4) make grid lines
5) make perpendicular labels be
   close to the axis near ticks
   projecting away from the plot 

I figured out that par(tck=..) solves three of the questions:
1) make ticks shorter or longer
3) make ticks project toward the plot
4) make grid lines
But my how do I?
5) set the small distance I want the perdendicular 
labels to be from the axis and from the ticks.

Hurr




--
View this message in context: 
http://r.789695.n4.nabble.com/Second-axis-on-bottom-of-graph-tp4690696p4690888.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] Second axis on bottom of graph

2014-05-20 Thread Hurr
How can I:
1) make ticks shorter or longer 
2) make ticks cross the axis line
3) make ticks project toward the plot 
4) make grid lines 
5) make perpendicular labels be 
   close to the axis near ticks 
   projecting away from the plot 




--
View this message in context: 
http://r.789695.n4.nabble.com/Second-axis-on-bottom-of-graph-tp4690696p4690867.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] Second axis on bottom of graph

2014-05-19 Thread Jim Lemon
On Mon, 19 May 2014 05:23:20 AM Hurr wrote:
> Thanks again Jim.
> Sorry, again I'm enclosing incomplete not-runnable code.
> Modified like this it works with the new staxlab function which
> I inserted before the second staxlab call.
> How long before I don't need to insert it?
> I didn't see a way to select the specific axis, so
> I used top.line=5. Is that what I should do?
> 
> 
axis(1,tick=TRUE,at=horTicLocs,labels=rep("",length(horLabels)),padj=0)
> staxlab(1,at=horTicLocs,labels=horLabels,srt=90,adj=c(1,0))
> nFrqTicInvls=9; frqTicLocs <- vector(length=nFrqTicInvls+1); frqLabels 
<-
> vector(length=nFrqTicInvls+1);
> frqInvl=(horAxisLims[2]-horAxisLims[1])/nFrqTicInvls
> for(i in 1:(nFrqTicInvls+1))frqTicLocs[i]=horAxisLims[1]+(i-1)*frqInvl
> for(i in
> 1:
(nFrqTicInvls+1))frqLabels[i]=.jcall(OuWid,"S","sR",frqTicLocs[i],as.integ
> er(4)) for(i in 1:(nFrqTicInvls+1))print(frqLabels[i])
> 
axis(1,tick=TRUE,line=3.5,at=frqTicLocs,labels=rep("",length(frqLabels)),pad
> j=0) staxlab(1,top.line=5,at=frqTicLocs,labels=frqLabels,srt=90)
> title(xlab="Cycles/Yr",line=6)
> 
> Hurr

I guess top.line=5 would be almost off the bottom of the plot. I assume 
that you know how it should look (I don't) and can adjust the top.line 
value until it looks right. the next version of plotrix will probably be out 
in a week or two.

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.


Re: [R] Second axis on bottom of graph

2014-05-19 Thread Hurr
Thanks again Jim.
Sorry, again I'm enclosing incomplete not-runnable code.
Modified like this it works with the new staxlab function which 
I inserted before the second staxlab call. 
How long before I don't need to insert it?
I didn't see a way to select the specific axis, so
I used top.line=5. Is that what I should do?

axis(1,tick=TRUE,at=horTicLocs,labels=rep("",length(horLabels)),padj=0)
staxlab(1,at=horTicLocs,labels=horLabels,srt=90,adj=c(1,0)) 
nFrqTicInvls=9; frqTicLocs <- vector(length=nFrqTicInvls+1); frqLabels <-
vector(length=nFrqTicInvls+1); 
frqInvl=(horAxisLims[2]-horAxisLims[1])/nFrqTicInvls 
for(i in 1:(nFrqTicInvls+1))frqTicLocs[i]=horAxisLims[1]+(i-1)*frqInvl 
for(i in
1:(nFrqTicInvls+1))frqLabels[i]=.jcall(OuWid,"S","sR",frqTicLocs[i],as.integer(4))
 
for(i in 1:(nFrqTicInvls+1))print(frqLabels[i]) 
axis(1,tick=TRUE,line=3.5,at=frqTicLocs,labels=rep("",length(frqLabels)),padj=0)
 
staxlab(1,top.line=5,at=frqTicLocs,labels=frqLabels,srt=90) 
title(xlab="Cycles/Yr",line=6)

Hurr




--
View this message in context: 
http://r.789695.n4.nabble.com/Second-axis-on-bottom-of-graph-tp4690696p4690819.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] Second axis on bottom of graph

2014-05-19 Thread Jim Lemon
On Sun, 18 May 2014 11:12:21 PM Hurr wrote:
> Thanks Jim, I see you are the author of staxlab.
> In the second staxlab I have tried line=3.5 like in axis, and
> top.line=3.5, separately, with no apparent effect.
> We should have to select the second axis somehow.
> Hurr
> 
> 
You are correct, as I didn't run your code I forgot about the rotation. Here 
is a revised staxlab function that should correct the problem and will 
appear in the next version of plotrix. Thanks for alerting me to it.

Jim
# staxlab produces staggered axis tick labels
# note that barplot() tends to mess things up by plotting an X axis 
# even when axes=FALSE

staxlab<-function(side=1,at,labels,nlines=2,top.line=0.5,
 line.spacing=0.8,srt=NA,ticklen=0.03,adj=1,...) {

 if(missing(labels)) labels<-at
 nlabels<-length(labels)
 if(missing(at)) at<-1:nlabels
 axislim<-par("usr")[3:4-2*side%%2]
 if(any(at < axislim[1]) || any(at > axislim[2]))
  warning("Some axis labels are off the plot")
 if(is.na(srt)) {
  linepos<-rep(top.line,nlines)
  for(i in 2:nlines) linepos[i]<-linepos[i-1]+line.spacing
  linepos<-rep(linepos,ceiling(nlabels/nlines))[1:nlabels]
  axis(side=side,at=at,labels=rep("",nlabels))
  mtext(text=labels,side=side,line=linepos,at=at,...)
 }
 else {
  linewidth<-strheight("M")
  xylim<-par("usr")
  if(side == 1) {
   xpos<-at
   if(par("ylog")) ypos<-10^(xylim[3]-ticklen*(xylim[4]-xylim[3]))
   else ypos<-xylim[3]-ticklen*(xylim[4]-xylim[3])-top.line*linewidth
  }
  if(side == 3) {
   xpos<-at
   if(par("ylog")) ypos<-10^(xylim[4]+ticklen*(xylim[4]-xylim[3]))
   else ypos<-xylim[4]+ticklen*(xylim[4]-xylim[3])+top.line*linewidth
  }
  if(side == 2) {
   ypos<-at
   if(par("xlog")) xpos<-10^(xylim[1]-ticklen*(xylim[2]-xylim[1]))
   else xpos<-xylim[1]-ticklen*(xylim[2]-xylim[1])-top.line*linewidth
  }
  if(side == 4) {
   ypos<-at
   if(par("xlog")) xpos<-10^(xylim[2]+ticklen*(xylim[2]-xylim[1]))
   else xpos<-xylim[2]+ticklen*(xylim[2]-xylim[1])+top.line*linewidth
  }
  par(xpd=TRUE)
  text(xpos,ypos,labels,srt=srt,adj=adj,...)
  par(xpd=FALSE)
 }
}
__
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] Second axis on bottom of graph

2014-05-18 Thread Hurr
Thanks Jim, I see you are the author of staxlab.
In the second staxlab I have tried line=3.5 like in axis, and 
top.line=3.5, separately, with no apparent effect.
We should have to select the second axis somehow.
Hurr




--
View this message in context: 
http://r.789695.n4.nabble.com/Second-axis-on-bottom-of-graph-tp4690696p4690805.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] Second axis on bottom of graph

2014-05-18 Thread Jim Lemon
On Sun, 18 May 2014 09:56:03 PM Hurr wrote:
> Sorry, I'm enclosing incomplete not-runnable code.
> 
> 
axis(1,tick=TRUE,at=horTicLocs,labels=rep("",length(horLabels)),padj=0)
> staxlab(1,at=horTicLocs,labels=horLabels,srt=90,adj=c(1,0))
> nFrqTicInvls=9; frqTicLocs <- vector(length=nFrqTicInvls+1);
> frqLabels <- vector(length=nFrqTicInvls+1);
> frqInvl=(horAxisLims[2]-horAxisLims[1])/nFrqTicInvls
> for(i in 1:(nFrqTicInvls+1))frqTicLocs[i]=horAxisLims[1]+(i-1)*frqInvl
> for(i in
> 1:
(nFrqTicInvls+1))frqLabels[i]=.jcall(OuWid,"S","sR",frqTicLocs[i],as.integ
> er(4)) for(i in 1:(nFrqTicInvls+1))print(frqLabels[i])
> 
axis(1,tick=TRUE,line=3.5,at=frqTicLocs,labels=rep("",length(frqLabels)),pad
> j=0) staxlab(1,at=frqTicLocs,labels=frqLabels,srt=90,adj=c(1,0))
> 
> The first axis and first staxlab works.
> The second axis is OK below the first axis.
> The print(frqLabels[i]) is OK.
> But the second staxlab puts the frqLabels[i] on the first (upper) axis.
> I must have to add something to the second staxlab to select second 
axis?
> 
Try looking at the help page, in particular the top.line argument.

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.


Re: [R] Second axis on bottom of graph

2014-05-18 Thread Hurr
Sorry, I'm enclosing incomplete not-runnable code.

axis(1,tick=TRUE,at=horTicLocs,labels=rep("",length(horLabels)),padj=0)
staxlab(1,at=horTicLocs,labels=horLabels,srt=90,adj=c(1,0)) 
nFrqTicInvls=9; frqTicLocs <- vector(length=nFrqTicInvls+1); 
frqLabels <- vector(length=nFrqTicInvls+1); 
frqInvl=(horAxisLims[2]-horAxisLims[1])/nFrqTicInvls 
for(i in 1:(nFrqTicInvls+1))frqTicLocs[i]=horAxisLims[1]+(i-1)*frqInvl 
for(i in
1:(nFrqTicInvls+1))frqLabels[i]=.jcall(OuWid,"S","sR",frqTicLocs[i],as.integer(4))
 
for(i in 1:(nFrqTicInvls+1))print(frqLabels[i]) 
axis(1,tick=TRUE,line=3.5,at=frqTicLocs,labels=rep("",length(frqLabels)),padj=0)
 
staxlab(1,at=frqTicLocs,labels=frqLabels,srt=90,adj=c(1,0)) 

The first axis and first staxlab works.
The second axis is OK below the first axis.
The print(frqLabels[i]) is OK.
But the second staxlab puts the frqLabels[i] on the first (upper) axis.
I must have to add something to the second staxlab to select second axis? 

Hurr




--
View this message in context: 
http://r.789695.n4.nabble.com/Second-axis-on-bottom-of-graph-tp4690696p4690803.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] Second axis on bottom of graph

2014-05-16 Thread S Ellison
David L Carlson [dcarl...@tamu.edu] said:
> ?title
>
> Used for main titles, subtitles, and x/y labels.

You might also check mtext as a way to add text at more or less arbitrary 
positions in the margin region.

And a look at some basic (and not so basic)  R plotting texts might save 
waiting for R-help answers; for example, Ted Harding's at 
https://www.harding.edu/fmccown/r/ and the R Graph Gallery at 
http://rgraphgallery.blogspot.co.uk/


S Ellison


***
This email and any attachments are confidential. Any use...{{dropped:8}}

__
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] Second axis on bottom of graph

2014-05-16 Thread David Winsemius

On May 16, 2014, at 8:59 AM, Hurr wrote:

> Sorry I didn't catch-on to xlab="" earlier.
> The following code works preliminarily,
> now I need to add an axis-title to the added axis.
> I don't see axistitle in axis command selections.

That's because it is part of the 'title' function.

-- 
David.

> 
> install.packages('plotrix')
> library(plotrix)
> horAxisLims=c(0,7213)
> verData=c(1,365,809,1252,1753,2191,2922,3409,3896,4383,4819,5255,5691,6128,6564,7000)
> #not fussy 
> horData=c(1,300,800,1200,1700,2100,2900,3400,3800,4300,4800,5200,5600,6100,6500,7000)
> #not at tics 
> horTicLocs=c(1,365,809,1252,1753,2191,2922,3409,3896,4383,4819,5255,5691,6128,6564,7000)
> horLabels=c('1Yr','1Da','10.8Hr','7Hr','5Hr','4Hr','3Hr','2.57Hr','2.25Hr','2Hr','1.82Hr','1.67Hr','1.54Hr','1.43Hr','1.34Hr','1.25Hr')
> plot(horData,verData,xaxt='n',xlim=horAxisLims,xlab="")
> axis(1,tick=TRUE,at=horTicLocs,labels=rep("",length(horLabels)))
> staxlab(1,at=horTicLocs,labels=horLabels,srt=90,adj=c(1,0))
> par(mar=c(8,4,4,2)+.1)  #c(bot,lef,top,rit); default:c(5,4,4,2)+.1 
> axis(1,labels=TRUE,tick=TRUE,line=3.5,at=NULL)
> 
> 
> 
> 
> --
> View this message in context: 
> http://r.789695.n4.nabble.com/Second-axis-on-bottom-of-graph-tp4690696p4690716.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.

David Winsemius
Alameda, CA, USA

__
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] Second axis on bottom of graph

2014-05-16 Thread Hurr
Thank you David for title()
In the axis command I need line=3.5, 
but it only works with whole numbers.
Better yet, it would be better to move 
the horLabels upward almost to the axis.
I can't figure out how to do that either.
Please show me.
Hurr





--
View this message in context: 
http://r.789695.n4.nabble.com/Second-axis-on-bottom-of-graph-tp4690696p4690729.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] Second axis on bottom of graph

2014-05-16 Thread David L Carlson
?title

Used for main titles, subtitles, and x/y labels.

David C

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of Hurr
Sent: Friday, May 16, 2014 10:59 AM
To: r-help@r-project.org
Subject: Re: [R] Second axis on bottom of graph

Sorry I didn't catch-on to xlab="" earlier.
The following code works preliminarily,
now I need to add an axis-title to the added axis.
I don't see axistitle in axis command selections.

install.packages('plotrix')
library(plotrix)
horAxisLims=c(0,7213)
verData=c(1,365,809,1252,1753,2191,2922,3409,3896,4383,4819,5255,5691,6128,6564,7000)
#not fussy 
horData=c(1,300,800,1200,1700,2100,2900,3400,3800,4300,4800,5200,5600,6100,6500,7000)
#not at tics 
horTicLocs=c(1,365,809,1252,1753,2191,2922,3409,3896,4383,4819,5255,5691,6128,6564,7000)
horLabels=c('1Yr','1Da','10.8Hr','7Hr','5Hr','4Hr','3Hr','2.57Hr','2.25Hr','2Hr','1.82Hr','1.67Hr','1.54Hr','1.43Hr','1.34Hr','1.25Hr')
plot(horData,verData,xaxt='n',xlim=horAxisLims,xlab="")
axis(1,tick=TRUE,at=horTicLocs,labels=rep("",length(horLabels)))
staxlab(1,at=horTicLocs,labels=horLabels,srt=90,adj=c(1,0))
par(mar=c(8,4,4,2)+.1)  #c(bot,lef,top,rit); default:c(5,4,4,2)+.1 
axis(1,labels=TRUE,tick=TRUE,line=3.5,at=NULL)




--
View this message in context: 
http://r.789695.n4.nabble.com/Second-axis-on-bottom-of-graph-tp4690696p4690716.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.

__
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] Second axis on bottom of graph

2014-05-16 Thread Hurr
Sorry I didn't catch-on to xlab="" earlier.
The following code works preliminarily,
now I need to add an axis-title to the added axis.
I don't see axistitle in axis command selections.

install.packages('plotrix')
library(plotrix)
horAxisLims=c(0,7213)
verData=c(1,365,809,1252,1753,2191,2922,3409,3896,4383,4819,5255,5691,6128,6564,7000)
#not fussy 
horData=c(1,300,800,1200,1700,2100,2900,3400,3800,4300,4800,5200,5600,6100,6500,7000)
#not at tics 
horTicLocs=c(1,365,809,1252,1753,2191,2922,3409,3896,4383,4819,5255,5691,6128,6564,7000)
horLabels=c('1Yr','1Da','10.8Hr','7Hr','5Hr','4Hr','3Hr','2.57Hr','2.25Hr','2Hr','1.82Hr','1.67Hr','1.54Hr','1.43Hr','1.34Hr','1.25Hr')
plot(horData,verData,xaxt='n',xlim=horAxisLims,xlab="")
axis(1,tick=TRUE,at=horTicLocs,labels=rep("",length(horLabels)))
staxlab(1,at=horTicLocs,labels=horLabels,srt=90,adj=c(1,0))
par(mar=c(8,4,4,2)+.1)  #c(bot,lef,top,rit); default:c(5,4,4,2)+.1 
axis(1,labels=TRUE,tick=TRUE,line=3.5,at=NULL)




--
View this message in context: 
http://r.789695.n4.nabble.com/Second-axis-on-bottom-of-graph-tp4690696p4690716.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] Second axis on bottom of graph

2014-05-16 Thread S Ellison
> To start-with, how do I omit the axis label?
> I tried xlab=NULL in the plot command
NULL is the default for xlab (see ?plot.default, which probably gives most of 
the information you need) 

Try 'xlab=""' or xlab=NA.


S



***
This email and any attachments are confidential. Any use...{{dropped:8}}

__
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] Second axis on bottom of graph

2014-05-16 Thread Hurr
Thankyou S Ellison,
The following code works preliminarily,
To start-with, how do I omit the axis label?
I tried xlab=NULL in the plot command

install.packages('plotrix')
library(plotrix)
horAxisLims=c(0,7213)
verData=c(1,365,809,1252,1753,2191,2922,3409,3896,4383,4819,5255,5691,6128,6564,7000)
#not fussy 
horData=c(1,300,800,1200,1700,2100,2900,3400,3800,4300,4800,5200,5600,6100,6500,7000)
#not at tics 
horTicLocs=c(1,365,809,1252,1753,2191,2922,3409,3896,4383,4819,5255,5691,6128,6564,7000)
horLabels=c('1Yr','1Da','10.8Hr','7Hr','5Hr','4Hr','3Hr','2.57Hr','2.25Hr','2Hr','1.82Hr','1.67Hr','1.54Hr','1.43Hr','1.34Hr','1.25Hr')
plot(horData,verData,xaxt='n',xlim=horAxisLims)
axis(1,tick=TRUE,at=horTicLocs,labels=rep("",length(horLabels)))
staxlab(1,at=horTicLocs,labels=horLabels,srt=90,adj=c(1,0))
par(mar=c(8,4,4,2)+.1)  #c(bot,lef,top,rit); default:c(5,4,4,2)+.1 
axis(1,labels=TRUE,tick=TRUE,line=3.5,at=NULL)




--
View this message in context: 
http://r.789695.n4.nabble.com/Second-axis-on-bottom-of-graph-tp4690696p4690707.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] Second axis on bottom of graph

2014-05-16 Thread S Ellison
> The first ten lines of code work OK temporariy.
> The final line is for a second more-usual axis.
> But if I say line=4 to prevent its overwriting the first axis, it goes off 
> the graph
> page.
> How do I solve that prob;em?

Change the plot margins before plotting using par(mar)

Example:

windows() #or X11()
par(mar=c(6.5, 4,4,2)+0.1)
plot(1:10, xlab="")
axis(1, line=4)

Also consider using par(mgp) to get the axis labels a bit closer to the axis, 
or using mtext() to place x axis labels.

S Ellison



***
This email and any attachments are confidential. Any use...{{dropped:8}}

__
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] Second axis on bottom of graph

2014-05-16 Thread Hurr
The first ten lines of code work OK temporariy.
The final line is for a second more-usual axis.
But if I say line=4 to prevent its overwriting the 
first axis, it goes off the graph page.
How do I solve that prob;em?

install.packages('plotrix')
library(plotrix)
horAxisLims=c(0,7213)
verData=c(1,365,809,1252,1753,2191,2922,3409,3896,4383,4819,5255,5691,6128,6564,7000)
#not fussy 
horData=c(1,300,800,1200,1700,2100,2900,3400,3800,4300,4800,5200,5600,6100,6500,7000)
#not at tics 
horTicLocs=c(1,365,809,1252,1753,2191,2922,3409,3896,4383,4819,5255,5691,6128,6564,7000)
horLabels=c('1Yr','1Da','10.8Hr','7Hr','5Hr','4Hr','3Hr','2.57Hr','2.25Hr','2Hr','1.82Hr','1.67Hr','1.54Hr','1.43Hr','1.34Hr','1.25Hr')
plot(horData,verData,xaxt='n',xlim=horAxisLims)
axis(1,tick=TRUE,at=horTicLocs,labels=rep("",length(horLabels)))
staxlab(1,at=horTicLocs,labels=horLabels,srt=90,adj=c(1,0))
axis(1,labels=TRUE,tick=TRUE,line=3,at=NULL)




--
View this message in context: 
http://r.789695.n4.nabble.com/Second-axis-on-bottom-of-graph-tp4690696.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.