[R] About radial.labels in plotrix
Hugues François
hugues.francois at irstea.fr
Mon Aug 18 19:00:32 CEST 2014
Really sorry for this mistake... I have several graph to do for different weather station and mylim and sta are elements to loop on each one. For the example, the code should be the one below.
Sometimes I feel dumb since I have read the "pretty" thing but I didn't understand the syntax "pretty(range(lengths))" and I tried to call directly radial.lim in radial.labels. Reading your mail, I understood... And add this simple line radial.labels=sort(pretty(c(0,mylim)), decreasing=T) which works perfectly ! Effectively, it was trivial
Thanks :D
Hugues.
data2 <- cast(data, gid ~ azimut, value = "angle")
radial.plot(
40-data2[,2:length(data2)],
labels=c("N","NE","E","SE","S","SW","W","NW"),
rp.type="p",
radial.lim=c(0,40),
line.col="#648bda",
lwd = 2,
start=1.56,
clockwise = T)
Of c
-----Message d'origine-----
De : Duncan Murdoch [mailto:murdoch.duncan at gmail.com]
Envoyé : lundi 18 août 2014 18:43
À : Hugues François; r-help at r-project.org
Objet : Re: [R] About radial.labels in plotrix
On 18/08/2014 12:25 PM, Hugues François wrote:
> Hello,
>
> Thanks for your answer. Of course I read the help but I didn't understand how to retrieve data from radial.lim. Maybe it is trivial for you but not for me.
>
> Attached to this message you will find some test data but you will need to cast them using reshape and this line (assuming you import the test data as "data"):
>
> data2 <- cast(data, gid ~ azimut, value = "angle")
But I don't know how you have set "mylim" or "sta", so I still can't run your code. Generally the best way to get useful help is to post a minimal, self-contained example that illustrates your problem.
I was assuming mylim was a vector of values, but if it is a single value, then it's trickier, because plotrix does some fancy stuff if mylim is length 2, and doesn't document it very clearly.
So I'd have 2 suggestions: you could try to figure out the fancy stuff that plotrix is doing (I think it's probably pretty(radial.lim), but I'm not sure), or you could explicitly enter the values where you want radial lines and labels, e.g.
radial.plot(
mylim-data2[data2[,1]==sta,2:length(data2)],
labels=c("N","NE","E","SE","S","SW","W","NW"),
rp.type="p",
radial.lim=c(0,1,2,3),
radial.labels=c(3,2,1,0),
line.col="#648bda",
lwd = 2,
start=1.56,
clockwise = T)
Duncan Murdoch
>
> Regards,
>
> Hugues.
>
>
> -----Message d'origine-----
> De : Duncan Murdoch [mailto:murdoch.duncan at gmail.com] Envoyé : lundi
> 18 août 2014 16:45 À : Hugues François; r-help at r-project.org Objet :
> Re: [R] About radial.labels in plotrix
>
> On 18/08/2014 9:35 AM, Hugues François wrote:
> > Hello,
> >
> >
> >
> > As you can read in the small code below, I do not represent directly my data but its inverse in the limits of my radial plot and I would like to reorder grid labelling from the upper value at the center and the lower one at the graph's border. In my example I would like to have 40 at the center and 0 on the border.
> >
> >
> >
> > http://oi62.tinypic.com/9zrntv.jpg
> >
> >
> >
> > I tried to find examples of radial.labels parameter on the web but I didn't find any.
> >
> >
> >
> > Here is my code :
> >
> >
> >
> > radial.plot(
> >
> > mylim-data2[data2[,1]==sta,2:length(data2)],
> >
> > labels=c("N","NE","E","SE","S","SW","W","NW"),
> >
> > rp.type="p",
> >
> > radial.lim=c(0,mylim),
> >
> > line.col="#648bda",
> >
> > lwd = 2,
> >
> > start=1.56,
> >
> > clockwise = T)
> >
> >
> >
>
> From the help page, it looks as though radial.labels should allow
> you to set that. You didn't post any data to demonstrate with, but I
> would assume it's a character vector (or numeric that will be coerced
> to
> character) of the same length as radial.lim.
>
> Duncan Murdoch
More information about the R-help
mailing list