Hi
Do you mean something like this ... ?
library(grid)
grid.newpage()
pushViewport(viewport(xscale=c(-2,2), yscale=c(-2,2)))
grid.text('T', cos(theta), sin(theta), default.units="native",
rot=(360/(2*pi))*(theta+(1/4)*2*pi))
Paul
On 25/08/16 14:16, Thomas Levine wrote:
I want to make a plot in polar coordinates. I want to use pch with
shapes that do not have radial symmetry, so I want to rotate them such
that they face inwards. I am using grid for my plotting, but I provide
motivating examples in graphics.
The following plot almost gets me what I want.
theta <- 2*pi*seq(0,7/8,1/8)
plot(cos(theta), sin(theta), pch=2, axes=F, asp=1)
But I want the points to face inwards. I can do something like this with
text, but I can set only a constant rotation
plot.new()
plot.window(c(-1,1),c(-1,1), asp=1)
text(cos(theta), sin(theta), 'Tom', srt
=runif(1,0,360))
To rotate all of the points, I can do something like this.
plot.new()
plot.window(c(-1,1),c(-1,1), asp=1)
for (the.theta in theta)
text(cos(the.theta), sin(the.theta), 'Tom',
srt=(360/(2*pi))*(the.theta-(1/4)*2*pi))
So perhaps I could use a "T" instead of a numeric pch and consequently
do something like this.
plot.new()
plot.window(c(-1,1),c(-1,1), asp=1)
for (the.theta in theta)
text(cos(the.theta), sin(the.theta), 'T',
srt=(360/(2*pi))*(the.theta+(1/4)*2*pi))
But that seems a bit silly.
Is there a more declarative way of doing this, preferably in grid?
Thanks
______________________________________________
[email protected] 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.
--
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
[email protected]
http://www.stat.auckland.ac.nz/~paul/
______________________________________________
[email protected] 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.