Re: [R] radial.plot shaded region

2013-12-12 Thread Hodge, Steven
From: Jim Lemon [j...@bitwrit.com.au]
Sent: Tuesday, December 10, 2013 21:57
To: Hodge, Steven
Cc: r-help@r-project.org
Subject: Re: [R] radial.plot shaded region

On 12/11/2013 11:24 AM, Jim Lemon wrote:
 ...
 There may be a solution using the radial.pie function, and if I find it,
 I'll post it.

 Hi Steve,
 Here it is. Just call radial.pie twice to get the annulus, then call
 radial.grid with the appropriate arguments, and then you can add
 whatever radial.plot you want, using the add argument.
 
 radial.pie(3.5,sector.colors=lightblue)
 radial.pie(3,sector.colors=white,add=TRUE)
 radial.grid(radial.lim=c(0,3.5),grid.pos=seq(0,3.5,length.out=8))
 
 Jim

Thank you very much! Both of your solutions work for me.

Steve
__
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] radial.plot shaded region

2013-12-10 Thread Hodge, Steven
I'm working with radial.plot in the plotrix package.

Is there a way to show a shaded region for a specific range of values in 
radial.lim?

For example:
# test data from radial.plot{plotrix}
testlen-c(sin(seq(0,1.98*pi,length=100))+2+rnorm(100)/10)
testpos-seq(0,1.98*pi,length=100)

# the original plot
radial.plot(testlen,testpos,rp.type=p,main=Test Polygon,line.col=blue)

# my attempt to shade the region between 3 and 3.5:
radial.plot(
matrix(c(3.5, 3), byrow = TRUE),
matrix(c(testpos, testpos), byrow = TRUE, nrow = 2),
rp.type=p,
main=Test Polygon,
poly.col = c('light blue', 'white'),
radial.lim = c(0, 3.5)
)
# In effect, draw a polygon at 3.5 filled with light blue, then another at 3 
filled with white.
# Now overplot the values of interest:
radial.plot(testlen,testpos,rp.type=p,main=Test Polygon,line.col=blue, 
radial.lim = c(0, 3.5), add = TRUE)

Is there an easier way? How can I re-draw the grid lines that are in the 
original plot?

Thanks,

Steve

. . . . . . . . . . . . . . .
Steven M. Hodge
Child and Adolescent Neurodevelopment Initiative S3-301
University of Massachusetts Medical School
55 Lake Avenue North
Worcester, MA 01655
steven.ho...@umassmed.edu

__
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] radial.plot shaded region

2013-12-10 Thread Jim Lemon

On 12/11/2013 10:33 AM, Hodge, Steven wrote:

I'm working with radial.plot in the plotrix package.

Is there a way to show a shaded region for a specific range of values in 
radial.lim?

For example:
# test data from radial.plot{plotrix}
testlen-c(sin(seq(0,1.98*pi,length=100))+2+rnorm(100)/10)
testpos-seq(0,1.98*pi,length=100)

# the original plot
radial.plot(testlen,testpos,rp.type=p,main=Test Polygon,line.col=blue)

# my attempt to shade the region between 3 and 3.5:
radial.plot(
matrix(c(3.5, 3), byrow = TRUE),
matrix(c(testpos, testpos), byrow = TRUE, nrow = 2),
rp.type=p,
main=Test Polygon,
poly.col = c('light blue', 'white'),
radial.lim = c(0, 3.5)
)
# In effect, draw a polygon at 3.5 filled with light blue, then another at 3 
filled with white.
# Now overplot the values of interest:
radial.plot(testlen,testpos,rp.type=p,main=Test Polygon,line.col=blue, 
radial.lim = c(0, 3.5), add = TRUE)

Is there an easier way? How can I re-draw the grid lines that are in the 
original plot?


Hi Steve,
That is a tricky one. The best I can do at the moment is to suggest the 
following be added:


radial.grid(radial.lim=c(0,3.5),
 grid.pos=seq(0,3.5,length.out=8))
radial.plot(testlen,testpos,rp.type=p,
 main=,line.col=blue,add=TRUE)

There may be a solution using the radial.pie function, and if I find it, 
I'll post it.


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] radial.plot shaded region

2013-12-10 Thread David Winsemius

On Dec 10, 2013, at 4:24 PM, Jim Lemon wrote:

 On 12/11/2013 10:33 AM, Hodge, Steven wrote:
 I'm working with radial.plot in the plotrix package.
 
 Is there a way to show a shaded region for a specific range of values in 
 radial.lim?
 
 For example:
 # test data from radial.plot{plotrix}
 testlen-c(sin(seq(0,1.98*pi,length=100))+2+rnorm(100)/10)
 testpos-seq(0,1.98*pi,length=100)
 
 # the original plot
 radial.plot(testlen,testpos,rp.type=p,main=Test Polygon,line.col=blue)
 
 # my attempt to shade the region between 3 and 3.5:
 radial.plot(
  matrix(c(3.5, 3), byrow = TRUE),
  matrix(c(testpos, testpos), byrow = TRUE, nrow = 2),
  rp.type=p,
  main=Test Polygon,
  poly.col = c('light blue', 'white'),
  radial.lim = c(0, 3.5)
  )
 # In effect, draw a polygon at 3.5 filled with light blue, then another at 3 
 filled with white.
 # Now overplot the values of interest:
 radial.plot(testlen,testpos,rp.type=p,main=Test Polygon,line.col=blue, 
 radial.lim = c(0, 3.5), add = TRUE)
 
 Is there an easier way? How can I re-draw the grid lines that are in the 
 original plot?
 
 Hi Steve,
 That is a tricky one. The best I can do at the moment is to suggest the 
 following be added:
 
 radial.grid(radial.lim=c(0,3.5),
 grid.pos=seq(0,3.5,length.out=8))
 radial.plot(testlen,testpos,rp.type=p,
 main=,line.col=blue,add=TRUE)
 
 There may be a solution using the radial.pie function, and if I find it, I'll 
 post it.

Looking at the code I would have thought it would not be too difficult to 
de-couple the plot setup and the grid plotting in this section:

if (!add) {
par(mar = mar, pty = s)
plot(c(-maxlength, maxlength), c(-maxlength, maxlength), 
type = n, axes = FALSE, main = main, xlab = xlab, 
ylab = ylab)
if (show.grid) {
for (i in seq(length(grid.pos), 1, by = -1)) {
xpos - cos(angles) * (grid.pos[i] - radial.lim[1])
ypos - sin(angles) * (grid.pos[i] - radial.lim[1])
polygon(xpos, ypos, border = grid.col, col = grid.bg)
}
}

But you are the Plotmeister and I am a humble Student.

-- 

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] radial.plot shaded region

2013-12-10 Thread Jim Lemon

On 12/11/2013 11:24 AM, Jim Lemon wrote:

...
There may be a solution using the radial.pie function, and if I find it,
I'll post it.


Hi Steve,
Here it is. Just call radial.pie twice to get the annulus, then call 
radial.grid with the appropriate arguments, and then you can add 
whatever radial.plot you want, using the add argument.


radial.pie(3.5,sector.colors=lightblue)
radial.pie(3,sector.colors=white,add=TRUE)
radial.grid(radial.lim=c(0,3.5),grid.pos=seq(0,3.5,length.out=8))

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.