[R] Curved arrows

Gábor Csárdi csardi at rmki.kfki.hu
Thu Apr 30 14:44:22 CEST 2009


On Thu, Apr 30, 2009 at 2:37 PM,  <p.s.chatfield at rdg.ac.uk> wrote:
> Hey - I tried this without success.  The igraph doesn't work with R 2.9.0,

That is strange, why not?

> so I'm using it with the 2.8.0 version which is the previous one I had.  Can you write a simple code that would put an arrow with a curved shaft on, e.g
> plot(3,5)
> igraph.Arrows(3,4,4,5)

Exactly like this, but the function is not exported, and you need the
'curved' argument:

plot(3,5)
igraph:::igraph.Arrows(3,4,4,5)
igraph:::igraph.Arrows(3,4,4,5, curved=TRUE)
igraph:::igraph.Arrows(3,4,4,5, curved=-0.5)
igraph:::igraph.Arrows(3,4,4,5, curved=-1)
igraph:::igraph.Arrows(3,4,4,5, curved=1)

You need igraph version 0.5.2 for this I think. Type
head(igraph:::igraph.Arrows)
to see the other arguments to play with.

Gabor

> Thanks for your quick reply before that was much appreciated,
>
> Paul
>
> Gábor Csárdi-2 wrote:
>>
>> Paul,
>>
>> there might be other solutions as well, but there is an internal
>> function in the igraph package that can draw curved arrows, it is
>> called igraph:::igraph.Arrows(). As it is an internal function, it is
>> not documented, but I think it is pretty straightforward to use. For
>> the 'curved' argument you can give a number, try values between 0 and
>> 1, or (if I remember well)  -1 and 0 if you want it to curve towards
>> the opposite side.
>>
>> Best,
>> Gabor
>>
>> On Thu, Apr 30, 2009 at 10:57 AM, Paul Chatfield
>> <p.s.chatfield at rdg.ac.uk> wrote:
>>>
>>> I'm trying to draw an arrow with a curved shaft on the graph as a
>>> straight
>>> one looks messy on a detailed graph.  I've looked in arrows but it
>>> doesn't
>>> seem to give an option.  larrows doesn't look much more promising.  I had
>>> a
>>> look in the archive and couldn't find anything.  Any thoughts?
>>>
>>> Thanks
>>>
>>> Paul
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Curved-arrows-tp23312316p23312316.html
>>> Sent from the R help mailing list archive at Nabble.com.
>>>
>>> ______________________________________________
>>> R-help at 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.
>>>
>>
>>
>>
>> --
>> Gabor Csardi <Gabor.Csardi at unil.ch>     UNIL DGM
>>
>> ______________________________________________
>> R-help at 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.
>>
>>
> Quoted from:  http://www.nabble.com/Curved-arrows-tp23312316p23312605.html
>
>



-- 
Gabor Csardi <Gabor.Csardi at unil.ch>     UNIL DGM




More information about the R-help mailing list