

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
______________________________________________
[hidden email] mailing list  To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/rhelpPLEASE do read the posting guide http://www.Rproject.org/postingguide.htmland provide commented, minimal, selfcontained, reproducible code.


Silly? Not really.
It's simple. It works.
You could jump into unicode for your text and make it look nicer, e.g.,
using '\u2191' or some other shape in place of 'T'
http://unicode.org/charts/http://unicode.org/charts/PDF/U2190.pdfDan
On Wed, Aug 24, 2016 at 7:16 PM, Thomas Levine < [hidden email]> 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
>
> ______________________________________________
> [hidden email] mailing list  To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/rhelp> PLEASE do read the posting guide http://www.Rproject.org/> postingguide.html
> and provide commented, minimal, selfcontained, reproducible code.
>
>

Dan Dalthorp, PhD
USGS Forest and Rangeland Ecosystem Science Center
Forest Sciences Lab, Rm 189
3200 SW Jefferson Way
Corvallis, OR 97331
ph: 5417500953
[hidden email]
[[alternative HTML version deleted]]
______________________________________________
[hidden email] mailing list  To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/rhelpPLEASE do read the posting guide http://www.Rproject.org/postingguide.htmland provide commented, minimal, selfcontained, reproducible code.


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
>
> ______________________________________________
> [hidden email] mailing list  To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/rhelp> PLEASE do read the posting guide http://www.Rproject.org/postingguide.html> and provide commented, minimal, selfcontained, reproducible code.
>

Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
[hidden email]
http://www.stat.auckland.ac.nz/~paul/______________________________________________
[hidden email] mailing list  To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/rhelpPLEASE do read the posting guide http://www.Rproject.org/postingguide.htmland provide commented, minimal, selfcontained, reproducible code.


Well this is great. Now I have answers for both graphics and grid.
The rot argument is exactly what I had wanted, except that I had
imagined it also working on points. But I had not thought to use
unicode, and that will probably make this plot even easier.
Thanks
______________________________________________
[hidden email] mailing list  To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/rhelpPLEASE do read the posting guide http://www.Rproject.org/postingguide.htmland provide commented, minimal, selfcontained, reproducible code.

